From 620a030a16c264f2c96649ee142eceebcabd2462 Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Mon, 30 Dec 2024 20:48:14 -0700 Subject: [PATCH] Added project picker script, changed some sway config defaults --- flake.lock | 232 +++++++++++++++++- .../sway/config.d/application_defaults | 15 +- nate/dotfiles/sway/config.d/default | 17 +- nate/dotfiles/sway/scripts/open_project.sh | 33 +++ 4 files changed, 266 insertions(+), 31 deletions(-) create mode 100755 nate/dotfiles/sway/scripts/open_project.sh diff --git a/flake.lock b/flake.lock index 096c834..b9c6006 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,57 @@ { "nodes": { + "catppuccin": { + "inputs": { + "catppuccin-v1_1": "catppuccin-v1_1", + "catppuccin-v1_2": "catppuccin-v1_2", + "home-manager": "home-manager", + "home-manager-stable": "home-manager-stable", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable", + "nuscht-search": "nuscht-search" + }, + "locked": { + "lastModified": 1735569271, + "narHash": "sha256-4CIClg4LMcmcCRIXSTcHDe6ujPzlxMtbCjMH7ntV784=", + "owner": "catppuccin", + "repo": "nix", + "rev": "7413a65b3ed37964c16e2fbe20145b55bcda8281", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, + "catppuccin-v1_1": { + "locked": { + "lastModified": 1734055249, + "narHash": "sha256-pCWJgwo77KD7EJpwynwKrWPZ//dwypHq2TfdzZWqK68=", + "rev": "7221d6ca17ac36ed20588e1c3a80177ac5843fa7", + "revCount": 326, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.1.1/0193bdc0-b045-7eed-bbec-95611a8ecdf5/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/catppuccin/nix/1.1.%2A.tar.gz" + } + }, + "catppuccin-v1_2": { + "locked": { + "lastModified": 1734728407, + "narHash": "sha256-Let3uJo4YDyfqbqaw66dpZxhJB2TrDyZWSFd5rpPLJA=", + "rev": "23ee86dbf4ed347878115a78971d43025362fab1", + "revCount": 341, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.2.0/0193e5e0-33b7-7149-a362-bfe56b20f64e/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/catppuccin/nix/1.2.%2A.tar.gz" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -21,7 +73,68 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { + "inputs": { + "nixpkgs": [ + "catppuccin", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1734622215, + "narHash": "sha256-OOfI0XhSJGHblfdNDhfnn8QnZxng63rWk9eeJ2tCbiI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1395379a7a36e40f2a76e7b9936cc52950baa1be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager-stable": { + "inputs": { + "nixpkgs": [ + "catppuccin", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1734366194, + "narHash": "sha256-vykpJ1xsdkv0j8WOVXrRFHUAdp9NXHpxdnn1F4pYgSw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "80b0fdf483c5d1cb75aaad909bd390d48673857f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -42,17 +155,61 @@ "type": "github" } }, - "nixpkgs": { + "ixx": { + "inputs": { + "flake-utils": [ + "catppuccin", + "nuscht-search", + "flake-utils" + ], + "nixpkgs": [ + "catppuccin", + "nuscht-search", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1734323986, - "narHash": "sha256-m/lh6hYMIWDYHCAsn81CDAiXoT3gmxXI9J987W5tZrE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "394571358ce82dff7411395829aa6a3aad45b907", + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NuschtOS", + "ref": "v0.0.6", + "repo": "ixx", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1734424634, + "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1734600368, + "narHash": "sha256-nbG9TijTMcfr+au7ZVbKpAhMJzzE2nQBYmRvSdXUD8g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b47fd6fa00c6afca88b8ee46cfdb00e104f50bca", + "type": "github" + }, + "original": { + "owner": "NixOS", "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" @@ -75,6 +232,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1734323986, + "narHash": "sha256-m/lh6hYMIWDYHCAsn81CDAiXoT3gmxXI9J987W5tZrE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "394571358ce82dff7411395829aa6a3aad45b907", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1734119587, "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", @@ -93,7 +266,7 @@ "nur": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "treefmt-nix": "treefmt-nix" }, "locked": { @@ -110,14 +283,53 @@ "type": "github" } }, + "nuscht-search": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "catppuccin", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733773348, + "narHash": "sha256-Y47y+LesOCkJaLvj+dI/Oa6FAKj/T9sKVKDXLNsViPw=", + "owner": "NuschtOS", + "repo": "search", + "rev": "3051be7f403bff1d1d380e4612f0c70675b44fc9", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "root": { "inputs": { - "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "catppuccin": "catppuccin", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/nate/dotfiles/sway/config.d/application_defaults b/nate/dotfiles/sway/config.d/application_defaults index 195caf1..7684bdf 100644 --- a/nate/dotfiles/sway/config.d/application_defaults +++ b/nate/dotfiles/sway/config.d/application_defaults @@ -1,22 +1,12 @@ # Assign workspaces -assign [app_id="firefox"] 2 -for_window [app_id="firefox"] focus - -assign [class="firefox"] 2 -for_window [class="firefox"] focus - assign [app_id=nautilus] 3 for_window [app_id=nautilus] focus -assign [class="Telegram"] 4 -for_window [class="Telegram"] focus - - for_window [app_id="xed"] focus # default keepass main window to scratch for_window [app_id="org.keepassxc.KeePassXC"] $floating_window -for_window [app_id="org.keepassxc.KeePassXC" title="KeePassXC"] move to scratchpad #, scratchpad show # default to show +for_window [app_id="org.keepassxc.KeePassXC" title="KeePassXC"] move to scratchpad # set floating (nontiling) for apps needing it: for_window [class="Yad" instance="yad"] floating enable @@ -30,7 +20,8 @@ for_window [class="qt5ct" instance="qt5ct"] floating enable, resize set width 60 for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable for_window [app_id="pamac-manager"] floating enable, resize set width 80 ppt height 70 ppt for_window [class="Lxappearance"] floating enable, resize set width 60 ppt height 50 ppt -for_window [class="steam" title="^((?!Steam$).)*"] floating enable +for_window [class="steam"] floating enable +for_window [class="steam" title="^Steam$"] floating disable # set floating for window roles for_window [window_role="pop-up"] floating enable diff --git a/nate/dotfiles/sway/config.d/default b/nate/dotfiles/sway/config.d/default index 91fca34..f1fe7fa 100644 --- a/nate/dotfiles/sway/config.d/default +++ b/nate/dotfiles/sway/config.d/default @@ -137,16 +137,14 @@ exec swayidle -w\ bindsym $mod+f fullscreen # Toggle the current focus between tiling and floating mode - bindsym $mod+Shift+space floating toggle + bindsym $mod+space floating toggle # Swap focus between the tiling area and the floating area - bindsym $mod+space focus mode_toggle + bindsym $mod+Shift+space focus mode_toggle # Move focus to the parent container bindsym $mod+a focus parent - # bindsym $mod+g exec ~/.config/sway/scripts/scale.sh inc - # bindsym $mod+m exec ~/.config/sway/scripts/scale.sh dec # # Scratchpad: @@ -221,13 +219,14 @@ bindsym $mod+r mode "resize" # bindsym $mod+t exec nautilus bindsym $mod+w exec firefox - bindsym $mod+j exec obsidian & ~/Documents/Obsidian Vault/auto-add.sh # # Screenshots # - bindsym $mod+Shift+p exec ~/.config/sway/scripts/screenshot.sh clipboard - bindsym $mod+p exec ~/.config/sway/scripts/screenshot.sh + bindsym $mod+Shift+p exec ~/.config/sway/scripts/screenshot.sh + bindsym $mod+p exec ~/.config/sway/scripts/screenshot.sh clipboard + # -# Keybindings List # - #bindsym $mod+t exec xed ~/.config/sway/cheatsheet +# + + bindsym $mod+s exec ~/.config/sway/scripts/open_project.sh diff --git a/nate/dotfiles/sway/scripts/open_project.sh b/nate/dotfiles/sway/scripts/open_project.sh new file mode 100755 index 0000000..571ac2e --- /dev/null +++ b/nate/dotfiles/sway/scripts/open_project.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +SRC_BASE="/home/nate/source" + +DIRECTORIES=$(fd -a -L -d 1 -t d . $SRC_BASE -x basename {};) +DIR=$(echo "$DIRECTORIES" | wofi --style="$HOME"/.config/wofi/style.widgets.css --conf="$HOME"/.config/wofi/config.screenshot 2>/dev/null) +FULL_DIR=$(eval echo "$SRC_BASE/$DIR") + +# Check if a directory is non empty +if [[ $(basename "$FULL_DIR") == $(basename "$SRC_BASE") ]]; then + exit 0 +fi + +foot --working-directory="$FULL_DIR" >/dev/null 2>&1 & +sleep 0.2 + +FFLINKS_FILE="$FULL_DIR/.fflinks" + +# If there is an .fflinks file +if [[ -f "$FFLINKS_FILE" ]]; then + swaymsg "splitv" + URLS=$(awk '{ printf "\"%s\" ", $0 }' $FFLINKS_FILE) + echo "$URLS" | xargs firefox & + sleep 0.2 + # firefox $URLS +fi + +swaymsg "focus parent; splith" +foot --working-directory="$FULL_DIR" >/dev/null 2>&1 & + +# Convert the ~ to the full path + +# Open two foot terminals in the specified directory