From 3dce49571afc6d9c1382748d0e6de2ddd41156db Mon Sep 17 00:00:00 2001 From: pagedMov Date: Sat, 12 Oct 2024 19:16:17 -0400 Subject: [PATCH] Gen 426: Shell script nix files work properly now --- flake.lock | 6 +- glasshouse-desktop/home/hyprland/config.nix | 1 + .../{scripts/compress.sh => compress.nix} | 7 +- .../home/scripts/{scripts/crs.sh => crs.nix} | 5 + glasshouse-desktop/home/scripts/default.nix | 132 ++++---- .../{scripts/extract.sh => extract.nix} | 5 + ...garbage-collect.sh => garbage-collect.nix} | 7 +- .../scripts/{scripts/homep.sh => homep.nix} | 5 + .../scripts/{scripts/homer.sh => homer.nix} | 5 + glasshouse-desktop/home/scripts/invoke.nix | 8 + .../{scripts/keybinds.sh => keybinds.nix} | 5 + .../scripts/{scripts/lofi.sh => lofi.nix} | 7 +- .../home/scripts/{scripts/mcd.sh => mcd.nix} | 5 + .../scripts/{scripts/music.sh => music.nix} | 5 + .../{scripts/nixcommit.sh => nixcommit.nix} | 11 +- .../scripts/{scripts/nixp.sh => nixp.nix} | 5 + .../scripts/{scripts/nixr.sh => nixr.nix} | 5 + glasshouse-desktop/home/scripts/nixswitch.nix | 18 ++ .../home/scripts/{scripts/nsp.sh => nsp.nix} | 5 + .../{scripts/power-menu.sh => power-menu.nix} | 5 + .../scripts/{scripts/runbg.sh => runbg.nix} | 7 +- .../{scripts/s_check.sh => s_check.nix} | 5 + .../home/scripts/scripts/ascii.sh | 45 --- .../home/scripts/scripts/invoke.sh | 3 - .../home/scripts/scripts/maxfetch.sh | 53 ---- .../home/scripts/scripts/nixswitch.sh | 13 - .../home/scripts/scripts/record.sh | 125 -------- .../home/scripts/scripts/rofi-power-menu.sh | 281 ------------------ .../home/scripts/scripts/screenshot.sh | 34 --- .../home/scripts/scripts/vm-start.sh | 11 - .../home/scripts/scripts/wall-change.sh | 9 - .../home/scripts/scripts/wallpaper-picker.sh | 12 - ...shutdown-script.sh => shutdown-script.nix} | 5 + .../scripts/{scripts/splash.sh => splash.nix} | 6 + .../{scripts/switchmon.sh => switchmon.nix} | 5 + .../toggle_blur.sh => toggle_blur.nix} | 5 + .../toggle_float.sh => toggle_float.nix} | 5 + ...toggle_oppacity.sh => toggle_oppacity.nix} | 5 + .../toggle_waybar.sh => toggle_waybar.nix} | 5 + 39 files changed, 210 insertions(+), 676 deletions(-) rename glasshouse-desktop/home/scripts/{scripts/compress.sh => compress.nix} (75%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/crs.sh => crs.nix} (51%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/extract.sh => extract.nix} (53%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/garbage-collect.sh => garbage-collect.nix} (84%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/homep.sh => homep.nix} (94%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/homer.sh => homer.nix} (90%) mode change 100755 => 100644 create mode 100644 glasshouse-desktop/home/scripts/invoke.nix rename glasshouse-desktop/home/scripts/{scripts/keybinds.sh => keybinds.nix} (80%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/lofi.sh => lofi.nix} (74%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/mcd.sh => mcd.nix} (53%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/music.sh => music.nix} (85%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/nixcommit.sh => nixcommit.nix} (64%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/nixp.sh => nixp.nix} (94%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/nixr.sh => nixr.nix} (90%) mode change 100755 => 100644 create mode 100644 glasshouse-desktop/home/scripts/nixswitch.nix rename glasshouse-desktop/home/scripts/{scripts/nsp.sh => nsp.nix} (52%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/power-menu.sh => power-menu.nix} (66%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/runbg.sh => runbg.nix} (84%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/s_check.sh => s_check.nix} (50%) mode change 100755 => 100644 delete mode 100755 glasshouse-desktop/home/scripts/scripts/ascii.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/invoke.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/maxfetch.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/nixswitch.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/record.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/rofi-power-menu.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/screenshot.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/vm-start.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/wall-change.sh delete mode 100755 glasshouse-desktop/home/scripts/scripts/wallpaper-picker.sh rename glasshouse-desktop/home/scripts/{scripts/shutdown-script.sh => shutdown-script.nix} (79%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/splash.sh => splash.nix} (75%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/switchmon.sh => switchmon.nix} (66%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/toggle_blur.sh => toggle_blur.nix} (77%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/toggle_float.sh => toggle_float.nix} (65%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/toggle_oppacity.sh => toggle_oppacity.nix} (83%) mode change 100755 => 100644 rename glasshouse-desktop/home/scripts/{scripts/toggle_waybar.sh => toggle_waybar.nix} (65%) mode change 100755 => 100644 diff --git a/flake.lock b/flake.lock index aa61ada..4311a84 100644 --- a/flake.lock +++ b/flake.lock @@ -825,11 +825,11 @@ }, "nur": { "locked": { - "lastModified": 1728764915, - "narHash": "sha256-2FQdE8mF1VcSCjM3tLggVwm+LO2FrMHVuWIUpjzBkrE=", + "lastModified": 1728769516, + "narHash": "sha256-pAN1uxvHwCVU6gNiNxI08BKM8+feS3rSLqbECkHp9LI=", "owner": "nix-community", "repo": "NUR", - "rev": "dfb94a4063e762fb282b91af80bff1ad1ddeb27f", + "rev": "2783ec9ab9ea630d8f7657bee76cef81e0c125e6", "type": "github" }, "original": { diff --git a/glasshouse-desktop/home/hyprland/config.nix b/glasshouse-desktop/home/hyprland/config.nix index eb74ec5..0af4bcd 100644 --- a/glasshouse-desktop/home/hyprland/config.nix +++ b/glasshouse-desktop/home/hyprland/config.nix @@ -141,6 +141,7 @@ "super, c, killactive," "super, e, exec, [float;size 45% 70%;move 10 50] kitty btop" "super, n, exec, [float;size 50% 35%;move 10 50] pavucontrol" + "super, p, exec, aplay ~/media/sound/soundtest.wav" "super shift, q, exit," "super, m, exec, fuzzel" "super, r, exec, neovide" diff --git a/glasshouse-desktop/home/scripts/scripts/compress.sh b/glasshouse-desktop/home/scripts/compress.nix old mode 100755 new mode 100644 similarity index 75% rename from glasshouse-desktop/home/scripts/scripts/compress.sh rename to glasshouse-desktop/home/scripts/compress.nix index 5c31e62..da9dc6e --- a/glasshouse-desktop/home/scripts/scripts/compress.sh +++ b/glasshouse-desktop/home/scripts/compress.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "compress" ('' #!/usr/bin/env bash if (( $# == 1 )) then @@ -7,4 +11,5 @@ if (( $# == 1 )) then tar -cvzf "$1.tar.gz" $1 else echo "Wrong number of arguments..." -fi \ No newline at end of file +fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/crs.sh b/glasshouse-desktop/home/scripts/crs.nix old mode 100755 new mode 100644 similarity index 51% rename from glasshouse-desktop/home/scripts/scripts/crs.sh rename to glasshouse-desktop/home/scripts/crs.nix index 0b54512..fef14b5 --- a/glasshouse-desktop/home/scripts/scripts/crs.sh +++ b/glasshouse-desktop/home/scripts/crs.nix @@ -1,4 +1,9 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "crs" ('' #!/run/current-system/sw/bin/bash cargo test && \ cargo run + '') diff --git a/glasshouse-desktop/home/scripts/default.nix b/glasshouse-desktop/home/scripts/default.nix index d9ce0ac..7713498 100644 --- a/glasshouse-desktop/home/scripts/default.nix +++ b/glasshouse-desktop/home/scripts/default.nix @@ -1,84 +1,56 @@ -{pkgs, ...}: let - wall-change = pkgs.writeShellScriptBin "wall-change" (builtins.readFile ./scripts/wall-change.sh); - wallpaper-picker = pkgs.writeShellScriptBin "wallpaper-picker" (builtins.readFile ./scripts/wallpaper-picker.sh); +{ self, pkgs, ... }: - runbg = pkgs.writeShellScriptBin "runbg" (builtins.readFile ./scripts/runbg.sh); - music = pkgs.writeShellScriptBin "music" (builtins.readFile ./scripts/music.sh); - lofi = pkgs.writeScriptBin "lofi" (builtins.readFile ./scripts/lofi.sh); - - splash = pkgs.writeShellScriptBin "splash" (builtins.readFile ./scripts/splash.sh); - switchmon = pkgs.writeShellScriptBin "switchmon" (builtins.readFile ./scripts/switchmon.sh); - nixswitch = pkgs.writeShellScriptBin "nixswitch" (builtins.readFile ./scripts/nixswitch.sh); - garbage-collect = pkgs.writeShellScriptBin "garbage-collect" (builtins.readFile ./scripts/garbage-collect.sh); - scheck = pkgs.writeShellScriptBin "scheck" (builtins.readFile ./scripts/s_check.sh); - mcd = pkgs.writeShellScriptBin "mcd" (builtins.readFile ./scripts/mcd.sh); - crs = pkgs.writeShellScriptBin "crs" (builtins.readFile ./scripts/crs.sh); - nixcommit = pkgs.writeShellScriptBin "nixcommit" (builtins.readFile ./scripts/nixcommit.sh); - invoke = pkgs.writeShellScriptBin "invoke" (builtins.readFile ./scripts/invoke.sh); - nsp = pkgs.writeShellScriptBin "nsp" (builtins.readFile ./scripts/nsp.sh); - nixp = pkgs.writeShellScriptBin "nixp" (builtins.readFile ./scripts/nixp.sh); - nixr = pkgs.writeShellScriptBin "nixr" (builtins.readFile ./scripts/nixr.sh); - homep = pkgs.writeShellScriptBin "homep" (builtins.readFile ./scripts/homep.sh); - homer = pkgs.writeShellScriptBin "homer" (builtins.readFile ./scripts/homer.sh); - - - toggle_blur = pkgs.writeScriptBin "toggle_blur" (builtins.readFile ./scripts/toggle_blur.sh); - toggle_oppacity = pkgs.writeScriptBin "toggle_oppacity" (builtins.readFile ./scripts/toggle_oppacity.sh); - - maxfetch = pkgs.writeScriptBin "maxfetch" (builtins.readFile ./scripts/maxfetch.sh); - - compress = pkgs.writeScriptBin "compress" (builtins.readFile ./scripts/compress.sh); - extract = pkgs.writeScriptBin "extract" (builtins.readFile ./scripts/extract.sh); - - shutdown-script = pkgs.writeScriptBin "shutdown-script" (builtins.readFile ./scripts/shutdown-script.sh); - - show-keybinds = pkgs.writeScriptBin "show-keybinds" (builtins.readFile ./scripts/keybinds.sh); - - vm-start = pkgs.writeScriptBin "vm-start" (builtins.readFile ./scripts/vm-start.sh); - - ascii = pkgs.writeScriptBin "ascii" (builtins.readFile ./scripts/ascii.sh); - - record = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh); -in { +let + compress = (import ./compress.nix { self = self; pkgs = pkgs;}); + crs = (import ./crs.nix { self = self; pkgs = pkgs;}); + extract = (import ./extract.nix { self = self; pkgs = pkgs;}); + garbage-collect = (import ./garbage-collect.nix { self = self; pkgs = pkgs;}); + homep = (import ./homep.nix { self = self; pkgs = pkgs;}); + homer = (import ./homer.nix { self = self; pkgs = pkgs;}); + invoke = (import ./invoke.nix { self = self; pkgs = pkgs;}); + lofi = (import ./lofi.nix { self = self; pkgs = pkgs;}); + mcd = (import ./mcd.nix { self = self; pkgs = pkgs;}); + music = (import ./music.nix { self = self; pkgs = pkgs;}); + nixcommit = (import ./nixcommit.nix { self = self; pkgs = pkgs;}); + nixp = (import ./nixp.nix { self = self; pkgs = pkgs;}); + nixr = (import ./nixr.nix { self = self; pkgs = pkgs;}); + nixswitch = (import ./nixswitch.nix { self = self; pkgs = pkgs;}); + nsp = (import ./nsp.nix { self = self; pkgs = pkgs;}); + runbg = (import ./runbg.nix { self = self; pkgs = pkgs;}); + scheck = (import ./s_check.nix { self = self; pkgs = pkgs;}); + shutdown-script = (import ./shutdown-script.nix { self = self; pkgs = pkgs;}); + splash = (import ./splash.nix { self = self; pkgs = pkgs;}); + switchmon = (import ./switchmon.nix { self = self; pkgs = pkgs;}); + toggle_blur = (import ./toggle_blur.nix { self = self; pkgs = pkgs;}); + toggle_float = (import ./toggle_float.nix { self = self; pkgs = pkgs;}); + toggle_oppacity = (import ./toggle_oppacity.nix { self = self; pkgs = pkgs;}); + toggle_waybar = (import ./toggle_waybar.nix { self = self; pkgs = pkgs;}); +in +{ home.packages = [ + splash nixswitch - garbage-collect - scheck - mcd - crs - nixcommit - invoke - nsp - wall-change - wallpaper-picker - nixp - nixr - homep - homer - - runbg - music - lofi - - splash - switchmon - - toggle_blur - toggle_oppacity - - maxfetch - - compress - extract - - shutdown-script - - show-keybinds - - vm-start - - ascii - - record - ]; + garbage-collect + mcd + crs + nixcommit + invoke + nsp + nixp + nixr + homep + scheck + homer + runbg + music + lofi + switchmon + toggle_blur + toggle_float + toggle_oppacity + toggle_waybar + compress + extract + shutdown-script + ]; } diff --git a/glasshouse-desktop/home/scripts/scripts/extract.sh b/glasshouse-desktop/home/scripts/extract.nix old mode 100755 new mode 100644 similarity index 53% rename from glasshouse-desktop/home/scripts/scripts/extract.sh rename to glasshouse-desktop/home/scripts/extract.nix index ecc25dd..a60b439 --- a/glasshouse-desktop/home/scripts/scripts/extract.sh +++ b/glasshouse-desktop/home/scripts/extract.nix @@ -1,6 +1,11 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "extract" ('' #!/usr/bin/env bash for i in "$@" ; do tar -xvzf $i break done + '') diff --git a/glasshouse-desktop/home/scripts/scripts/garbage-collect.sh b/glasshouse-desktop/home/scripts/garbage-collect.nix old mode 100755 new mode 100644 similarity index 84% rename from glasshouse-desktop/home/scripts/scripts/garbage-collect.sh rename to glasshouse-desktop/home/scripts/garbage-collect.nix index 10e0337..b59eaed --- a/glasshouse-desktop/home/scripts/scripts/garbage-collect.sh +++ b/glasshouse-desktop/home/scripts/garbage-collect.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "garbage-collect" ('' #!/run/current-system/sw/bin/bash @@ -5,7 +9,7 @@ echo "This will delete all unused paths in the nix store and delete any files in echo -e "\033[1;4;38;2;243;139;168mThis process is irreversible.\033[0m Are you sure?" select yn in "Yes" "No"; do case $yn in - Yes ) echo "Sweeping system...";scheck && runbg aplay "$HOME/media/sound/sys/collectgarbage.wav";break;; + Yes ) echo "Sweeping system...";scheck && runbg aplay "$HOME/media/sound/sys/collectgarbage.wav";break;; No ) echo "Canceling garbage collection."; return;; esac done @@ -24,3 +28,4 @@ fi total_freed=$(echo "$nix_freed + $rm_freed" | bc) echo -e "System cleaning complete, freed \033[1;4;38;2;166;227;161m$total_freed MiB\033[0m in total" scheck && runbg aplay "$HOME/media/sound/sys/rm.wav" + '') diff --git a/glasshouse-desktop/home/scripts/scripts/homep.sh b/glasshouse-desktop/home/scripts/homep.nix old mode 100755 new mode 100644 similarity index 94% rename from glasshouse-desktop/home/scripts/scripts/homep.sh rename to glasshouse-desktop/home/scripts/homep.nix index c36b0d8..00a6243 --- a/glasshouse-desktop/home/scripts/scripts/homep.sh +++ b/glasshouse-desktop/home/scripts/homep.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "homep" ('' #!/run/current-system/sw/bin/bash # Ensure the package manifest is generated or updated @@ -28,3 +32,4 @@ if [ -n "$selected_packages" ]; then else echo "No packages selected." fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/homer.sh b/glasshouse-desktop/home/scripts/homer.nix old mode 100755 new mode 100644 similarity index 90% rename from glasshouse-desktop/home/scripts/scripts/homer.sh rename to glasshouse-desktop/home/scripts/homer.nix index 86133ba..7bf6aac --- a/glasshouse-desktop/home/scripts/scripts/homer.sh +++ b/glasshouse-desktop/home/scripts/homer.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "homer" ('' #!/run/current-system/sw/bin/bash selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix" | sed '1d;$d' | fzf -m) @@ -22,3 +26,4 @@ fi + '') diff --git a/glasshouse-desktop/home/scripts/invoke.nix b/glasshouse-desktop/home/scripts/invoke.nix new file mode 100644 index 0000000..1ebdda1 --- /dev/null +++ b/glasshouse-desktop/home/scripts/invoke.nix @@ -0,0 +1,8 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "invoke" ('' +#!/run/current-system/sw/bin/bash + +nix run nixpkgs#$"@" + '') diff --git a/glasshouse-desktop/home/scripts/scripts/keybinds.sh b/glasshouse-desktop/home/scripts/keybinds.nix old mode 100755 new mode 100644 similarity index 80% rename from glasshouse-desktop/home/scripts/scripts/keybinds.sh rename to glasshouse-desktop/home/scripts/keybinds.nix index 13c8da9..52c1e25 --- a/glasshouse-desktop/home/scripts/scripts/keybinds.sh +++ b/glasshouse-desktop/home/scripts/keybinds.nix @@ -1,6 +1,11 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "keybinds" ('' #!/usr/bin/env bash config_file=~/.config/hypr/hyprland.conf keybinds=$(grep -oP '(?<=bind=).*' $config_file) keybinds=$(echo "$keybinds" | sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g') rofi -dmenu -theme-str 'window {width: 50%;}' <<< "$keybinds" + '') diff --git a/glasshouse-desktop/home/scripts/scripts/lofi.sh b/glasshouse-desktop/home/scripts/lofi.nix old mode 100755 new mode 100644 similarity index 74% rename from glasshouse-desktop/home/scripts/scripts/lofi.sh rename to glasshouse-desktop/home/scripts/lofi.nix index 76cdc8f..b7c07ea --- a/glasshouse-desktop/home/scripts/scripts/lofi.sh +++ b/glasshouse-desktop/home/scripts/lofi.nix @@ -1,7 +1,12 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "lofi" ('' #!/usr/bin/env bash if (ps aux | grep mpv | grep -v grep > /dev/null) then pkill mpv else runbg mpv --no-video https://www.youtube.com/live/jfKfPfyJRdk?si=OF0HKrYFFj33BzMo -fi \ No newline at end of file +fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/mcd.sh b/glasshouse-desktop/home/scripts/mcd.nix old mode 100755 new mode 100644 similarity index 53% rename from glasshouse-desktop/home/scripts/scripts/mcd.sh rename to glasshouse-desktop/home/scripts/mcd.nix index c566d9d..364480b --- a/glasshouse-desktop/home/scripts/scripts/mcd.sh +++ b/glasshouse-desktop/home/scripts/mcd.nix @@ -1,5 +1,10 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "mcd" ('' #!/run/current-system/sw/bin/bash mkdir -p "$1" cd "$1" || exit + '') diff --git a/glasshouse-desktop/home/scripts/scripts/music.sh b/glasshouse-desktop/home/scripts/music.nix old mode 100755 new mode 100644 similarity index 85% rename from glasshouse-desktop/home/scripts/scripts/music.sh rename to glasshouse-desktop/home/scripts/music.nix index 03094d2..917ec9e --- a/glasshouse-desktop/home/scripts/scripts/music.sh +++ b/glasshouse-desktop/home/scripts/music.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "music" ('' #!/usr/bin/env bash if (ps aux | grep audacious | grep -v grep > /dev/null) then @@ -8,3 +12,4 @@ else audtool playlist-repeat-status |grep "on" || audtool playlist-repeat-toggle audtool playlist-shuffle-status|grep "on" || audtool playlist-shuffle-toggle fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/nixcommit.sh b/glasshouse-desktop/home/scripts/nixcommit.nix old mode 100755 new mode 100644 similarity index 64% rename from glasshouse-desktop/home/scripts/scripts/nixcommit.sh rename to glasshouse-desktop/home/scripts/nixcommit.nix index c6691c2..cb6b875 --- a/glasshouse-desktop/home/scripts/scripts/nixcommit.sh +++ b/glasshouse-desktop/home/scripts/nixcommit.nix @@ -1,6 +1,10 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "nixcommit" ('' #!/run/current-system/sw/bin/bash -scheck && runbg aplay ~/media/sound/sys/nixswitch-start.wav +scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav builtin cd "$HOME/sysflakes" || exit nix flake update if [ -n "$2" ]; then @@ -13,12 +17,13 @@ gen=$((gen + 1)) diffcheck=$(git status | grep "working tree clean") if [ -n "$diffcheck" ]; then - scheck && runbg aplay ~/media/sound/sys/warning.wav + scheck && runbg aplay ${self}/media/sound/warning.wav echo "Nothing to commit" exit fi git add . git commit -m "Gen $gen: $1" git push -scheck && runbg aplay ~/media/sound/sys/gitpush.wav +scheck && runbg aplay ${self}/media/sound/gitpush.wav builtin cd - || exit + '') diff --git a/glasshouse-desktop/home/scripts/scripts/nixp.sh b/glasshouse-desktop/home/scripts/nixp.nix old mode 100755 new mode 100644 similarity index 94% rename from glasshouse-desktop/home/scripts/scripts/nixp.sh rename to glasshouse-desktop/home/scripts/nixp.nix index a29d74b..76ea1f5 --- a/glasshouse-desktop/home/scripts/scripts/nixp.sh +++ b/glasshouse-desktop/home/scripts/nixp.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "nixp" ('' #!/run/current-system/sw/bin/bash # Ensure the package manifest is generated or updated @@ -28,3 +32,4 @@ if [ -n "$selected_packages" ]; then else echo "No packages selected." fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/nixr.sh b/glasshouse-desktop/home/scripts/nixr.nix old mode 100755 new mode 100644 similarity index 90% rename from glasshouse-desktop/home/scripts/scripts/nixr.sh rename to glasshouse-desktop/home/scripts/nixr.nix index 021fe8d..c1a465a --- a/glasshouse-desktop/home/scripts/scripts/nixr.sh +++ b/glasshouse-desktop/home/scripts/nixr.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "nixr" ('' #!/run/current-system/sw/bin/bash selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix" | sed '1d;$d' | fzf -m) @@ -22,3 +26,4 @@ fi + '') diff --git a/glasshouse-desktop/home/scripts/nixswitch.nix b/glasshouse-desktop/home/scripts/nixswitch.nix new file mode 100644 index 0000000..2c0efd3 --- /dev/null +++ b/glasshouse-desktop/home/scripts/nixswitch.nix @@ -0,0 +1,18 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "nixswitch" ('' +#!/run/current-system/sw/bin/bash + +scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav +builtin cd "$HOME/sysflakes" || exit + +nix flake update +sudo nixos-rebuild switch --flake "$HOME/sysflakes#glasshouse-desktop" +if [ $? -eq 0 ]; then + scheck && runbg aplay ${self}/media/sound/update.wav +else + scheck && runbg aplay ${self}/media/sound/error.wav +fi +builtin cd "$OLDPWD" || exit + '') diff --git a/glasshouse-desktop/home/scripts/scripts/nsp.sh b/glasshouse-desktop/home/scripts/nsp.nix old mode 100755 new mode 100644 similarity index 52% rename from glasshouse-desktop/home/scripts/scripts/nsp.sh rename to glasshouse-desktop/home/scripts/nsp.nix index e08e109..45cd47a --- a/glasshouse-desktop/home/scripts/scripts/nsp.sh +++ b/glasshouse-desktop/home/scripts/nsp.nix @@ -1,3 +1,8 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "nsp" ('' #!/run/current-system/sw/bin/bash nix-shell -p "$@" --run zsh + '') diff --git a/glasshouse-desktop/home/scripts/scripts/power-menu.sh b/glasshouse-desktop/home/scripts/power-menu.nix old mode 100755 new mode 100644 similarity index 66% rename from glasshouse-desktop/home/scripts/scripts/power-menu.sh rename to glasshouse-desktop/home/scripts/power-menu.nix index 0821353..4890c67 --- a/glasshouse-desktop/home/scripts/scripts/power-menu.sh +++ b/glasshouse-desktop/home/scripts/power-menu.nix @@ -1,3 +1,8 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "power-menu" ('' #!/usr/bin/env bash rofi -show p -modi p:'rofi-power-menu' -theme-str 'window {width: 10em; height: 15em;} listview {lines: 5;}' + '') diff --git a/glasshouse-desktop/home/scripts/scripts/runbg.sh b/glasshouse-desktop/home/scripts/runbg.nix old mode 100755 new mode 100644 similarity index 84% rename from glasshouse-desktop/home/scripts/scripts/runbg.sh rename to glasshouse-desktop/home/scripts/runbg.nix index dc5088d..a0849e4 --- a/glasshouse-desktop/home/scripts/scripts/runbg.sh +++ b/glasshouse-desktop/home/scripts/runbg.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "runbg" ('' #!/usr/bin/env bash [ $# -eq 0 ] && { # $# is number of args @@ -13,4 +17,5 @@ shift # remove $1, now $prog, from args tty -s && exec /dev/null # if stdout is a terminal, redirect to null tty -s <&2 && exec 2>&1 # stderr to stdout (which might not be null) -"$prog" "$@" & # $@ is all args \ No newline at end of file +"$prog" "$@" & # $@ is all args + '') diff --git a/glasshouse-desktop/home/scripts/scripts/s_check.sh b/glasshouse-desktop/home/scripts/s_check.nix old mode 100755 new mode 100644 similarity index 50% rename from glasshouse-desktop/home/scripts/scripts/s_check.sh rename to glasshouse-desktop/home/scripts/s_check.nix index c2a2fcd..7509bb5 --- a/glasshouse-desktop/home/scripts/scripts/s_check.sh +++ b/glasshouse-desktop/home/scripts/s_check.nix @@ -1,3 +1,8 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "scheck" ('' #!/run/current-system/sw/bin/bash [ "$SOUNDS_ENABLED" -eq 1 ] + '') diff --git a/glasshouse-desktop/home/scripts/scripts/ascii.sh b/glasshouse-desktop/home/scripts/scripts/ascii.sh deleted file mode 100755 index 0ff7489..0000000 --- a/glasshouse-desktop/home/scripts/scripts/ascii.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env zsh - -RED=$(tput setaf 1) -GREEN=$(tput setaf 2) -BLUE=$(tput setaf 4) -MAGENTA=$(tput setaf 5) -CYAN=$(tput setaf 6) -NORMAL=$(tput sgr0) - -echo -e "┌─────────────┬─────────────┬─────────────┬─────────────┐" -echo -e "│ ${BLUE}Dec${NORMAL} ${GREEN}Hex${NORMAL} Chr │ ${BLUE}Dec${NORMAL} ${GREEN}Hex${NORMAL} Chr │ ${BLUE}Dec${NORMAL} ${GREEN}Hex${NORMAL} Chr │ ${BLUE}Dec${NORMAL} ${GREEN}Hex${NORMAL} Chr │" -echo -e "├─────────────┼─────────────┼─────────────┼─────────────┤" -echo -e "│ 0 0 \033[2mNUL\033[0m\033[0m │ 32 20 │ 64 40 ${CYAN}@${NORMAL} │ 96 60 ${CYAN}\`${NORMAL} │" -echo -e "│ 1 1 \033[2mSOH\033[0m │ 33 21 ${CYAN}!${NORMAL} │ 65 41 ${GREEN}A${NORMAL} │ 97 61 ${GREEN}a${NORMAL} │" -echo -e "│ 2 2 \033[2mSTX\033[0m │ 34 22 ${CYAN}\"${NORMAL} │ 66 42 ${GREEN}B${NORMAL} │ 98 62 ${GREEN}b${NORMAL} │" -echo -e "│ 3 3 \033[2mETX\033[0m │ 35 23 ${CYAN}#${NORMAL} │ 67 43 ${GREEN}C${NORMAL} │ 99 63 ${GREEN}c${NORMAL} │" -echo -e "│ 4 4 \033[2mEOT\033[0m │ 36 24 ${CYAN}\$${NORMAL} │ 68 44 ${GREEN}D${NORMAL} │ 100 64 ${GREEN}d${NORMAL} │" -echo -e "│ 5 5 \033[2mENQ\033[0m │ 37 25 ${CYAN}%${NORMAL} │ 69 45 ${GREEN}E${NORMAL} │ 101 65 ${GREEN}e${NORMAL} │" -echo -e "│ 6 6 \033[2mACK\033[0m │ 38 26 ${CYAN}&${NORMAL} │ 70 46 ${GREEN}F${NORMAL} │ 102 66 ${GREEN}f${NORMAL} │" -echo -e "│ 7 7 \033[2mBEL\033[0m │ 39 27 ${CYAN}'${NORMAL} │ 71 47 ${GREEN}G${NORMAL} │ 103 67 ${GREEN}g${NORMAL} │" -echo -e "│ 8 8 \033[2mBS\033[0m │ 40 28 ${CYAN}(${NORMAL} │ 72 48 ${GREEN}H${NORMAL} │ 104 68 ${GREEN}h${NORMAL} │" -echo -e "│ 9 9 \033[2mHT\033[0m │ 41 29 ${CYAN})${NORMAL} │ 73 49 ${GREEN}I${NORMAL} │ 105 69 ${GREEN}i${NORMAL} │" -echo -e "│ 10 A \033[2mLF\033[0m │ 42 2A ${CYAN}*${NORMAL} │ 74 4A ${GREEN}J${NORMAL} │ 106 6A ${GREEN}j${NORMAL} │" -echo -e "│ 11 B \033[2mVT\033[0m │ 43 2B ${CYAN}+${NORMAL} │ 75 4B ${GREEN}K${NORMAL} │ 107 6B ${GREEN}k${NORMAL} │" -echo -e "│ 12 C \033[2mFF\033[0m │ 44 2C ${CYAN},${NORMAL} │ 76 4C ${GREEN}L${NORMAL} │ 108 6C ${GREEN}l${NORMAL} │" -echo -e "│ 13 D \033[2mCR\033[0m │ 45 2D ${CYAN}-${NORMAL} │ 77 4D ${GREEN}M${NORMAL} │ 109 6D ${GREEN}m${NORMAL} │" -echo -e "│ 14 E \033[2mSO\033[0m │ 46 2E ${CYAN}.${NORMAL} │ 78 4E ${GREEN}N${NORMAL} │ 110 6E ${GREEN}n${NORMAL} │" -echo -e "│ 15 F \033[2mSI\033[0m │ 47 2F ${CYAN}/${NORMAL} │ 79 4F ${GREEN}O${NORMAL} │ 111 6F ${GREEN}o${NORMAL} │" -echo -e "│ 16 10 \033[2mDLE\033[0m │ 48 30 ${RED}0${NORMAL} │ 80 50 ${GREEN}P${NORMAL} │ 112 70 ${GREEN}p${NORMAL} │" -echo -e "│ 17 11 \033[2mDC1\033[0m │ 49 31 ${RED}1${NORMAL} │ 81 51 ${GREEN}Q${NORMAL} │ 113 71 ${GREEN}q${NORMAL} │" -echo -e "│ 18 12 \033[2mDC2\033[0m │ 50 32 ${RED}2${NORMAL} │ 82 52 ${GREEN}R${NORMAL} │ 114 72 ${GREEN}r${NORMAL} │" -echo -e "│ 19 13 \033[2mDC3\033[0m │ 51 33 ${RED}3${NORMAL} │ 83 53 ${GREEN}S${NORMAL} │ 115 73 ${GREEN}s${NORMAL} │" -echo -e "│ 20 14 \033[2mDC4\033[0m │ 52 34 ${RED}4${NORMAL} │ 84 54 ${GREEN}T${NORMAL} │ 116 74 ${GREEN}t${NORMAL} │" -echo -e "│ 21 15 \033[2mNAK\033[0m │ 53 35 ${RED}5${NORMAL} │ 85 55 ${GREEN}U${NORMAL} │ 117 75 ${GREEN}u${NORMAL} │" -echo -e "│ 22 16 \033[2mSYN\033[0m │ 54 36 ${RED}6${NORMAL} │ 86 56 ${GREEN}V${NORMAL} │ 118 76 ${GREEN}v${NORMAL} │" -echo -e "│ 23 17 \033[2mETB\033[0m │ 55 37 ${RED}7${NORMAL} │ 87 57 ${GREEN}W${NORMAL} │ 119 77 ${GREEN}w${NORMAL} │" -echo -e "│ 24 18 \033[2mCAN\033[0m │ 56 38 ${RED}8${NORMAL} │ 88 58 ${GREEN}X${NORMAL} │ 120 78 ${GREEN}x${NORMAL} │" -echo -e "│ 25 19 \033[2mEM\033[0m │ 57 39 ${RED}9${NORMAL} │ 89 59 ${GREEN}Y${NORMAL} │ 121 79 ${GREEN}y${NORMAL} │" -echo -e "│ 26 1A \033[2mSUB\033[0m │ 58 3A ${CYAN}:${NORMAL} │ 90 5A ${GREEN}Z${NORMAL} │ 122 7A ${GREEN}z${NORMAL} │" -echo -e "│ 27 1B \033[2mESC\033[0m │ 59 3B ${CYAN};${NORMAL} │ 91 5B ${CYAN}[${NORMAL} │ 123 7B ${CYAN}{${NORMAL} │" -echo -e "│ 28 1C \033[2mFS\033[0m │ 60 3C ${CYAN}<${NORMAL} │ 92 5C ${CYAN}\\${NORMAL} │ 124 7C ${CYAN}|${NORMAL} │" -echo -e "│ 29 1D \033[2mGS\033[0m │ 61 3D ${CYAN}=${NORMAL} │ 93 5D ${CYAN}]${NORMAL} │ 125 7D ${CYAN}}${NORMAL} │" -echo -e "│ 30 1E \033[2mRS\033[0m │ 62 3E ${CYAN}>${NORMAL} │ 94 5E ${CYAN}^${NORMAL} │ 126 7E ${CYAN}~${NORMAL} │" -echo -e "│ 31 1F \033[2mUS\033[0m │ 63 3F ${CYAN}?${NORMAL} │ 95 5F ${CYAN}_${NORMAL} │ 127 7F \033[2mDEL\033[0m │" -echo -e "└─────────────┴─────────────┴─────────────┴─────────────┘" diff --git a/glasshouse-desktop/home/scripts/scripts/invoke.sh b/glasshouse-desktop/home/scripts/scripts/invoke.sh deleted file mode 100755 index 6fe752d..0000000 --- a/glasshouse-desktop/home/scripts/scripts/invoke.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/run/current-system/sw/bin/bash - -nix run nixpkgs#$"@" diff --git a/glasshouse-desktop/home/scripts/scripts/maxfetch.sh b/glasshouse-desktop/home/scripts/scripts/maxfetch.sh deleted file mode 100755 index 486f411..0000000 --- a/glasshouse-desktop/home/scripts/scripts/maxfetch.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -unicode=" " -version="1.2.0" - -_black=$(tput setaf 0) -red=$(tput setaf 1) -green=$(tput setaf 2) -yellow=$(tput setaf 3) -blue=$(tput setaf 4) -magenta=$(tput setaf 5) -cyan=$(tput setaf 6) -_white=$(tput setaf 7) -_bright=$(tput bold) -normal=$(tput sgr0) -_underline=$(tput smul) - -up=$(uptime | awk -F'( |,|:)+' '{ - d=h=m=0; - if ($7=="min") - m=$6; - else { - if ($7~/^day/) { d=$6; h=$8; m=$9} - else {h=$6;m=$7} - } - } - { print h+0,"h",m+0,"m" } -') -up=$(sed -e "s/ h/h/g" <<< ${up}) -up=$(sed -e "s/ m/m/g" <<< ${up}) - -pkgs=$(nix-store --query --requisites /run/current-system | wc -l) - -fetch() { - echo "${cyan}$(tput bold) _ ___ ____ ____ ${normal}$(tput sgr0)" - echo "${cyan}$(tput bold) / |/ (_)_ __/ __ \/ __/ ${normal}$(tput sgr0)" - echo "${cyan}$(tput bold) / / /\ \ / /_/ /\ \ ${normal}$(tput sgr0)" - echo "${cyan}$(tput bold) /_/|_/_//_\_"'\\'"____/___/ ${normal}$(tput sgr0)" - echo "" - echo " ╭─────────────╮ " - echo " │ ${red} ${normal} user │ ${red}$(whoami)${normal}" - echo " │ ${yellow} ${normal} distro │ ${yellow}$(sed -nE "s@PRETTY_NAME=\"([^\"]*)\"@\1@p" /etc/os-release)${normal} " - echo " │ ${green} ${normal} kernel │ ${green}$(uname -r)${normal} " - echo " │ ${cyan}󱂬 ${normal} de/wm │ ${cyan}$XDG_CURRENT_DESKTOP${normal} " - echo " │ ${blue} ${normal} uptime │ ${blue}${up}${normal} " - echo " │ ${magenta} ${normal} shell │ ${magenta}$(echo ${SHELL##*/})${normal} " - echo " │ ${red}󰏖 ${normal} pkgs │ ${red}${pkgs}${normal} " - echo " ├─────────────┤ " - echo " │ ${_white} ${normal}colors │${_white}$unicode${normal}${red}$unicode${normal}${yellow}$unicode${normal}${green}$unicode${normal}${cyan}$unicode${normal}${blue}$unicode${normal}${magenta}$unicode${normal}${_black}$unicode${normal}" - echo " ╰─────────────╯ " -} - -fetch && exit 0 \ No newline at end of file diff --git a/glasshouse-desktop/home/scripts/scripts/nixswitch.sh b/glasshouse-desktop/home/scripts/scripts/nixswitch.sh deleted file mode 100755 index 2cadca8..0000000 --- a/glasshouse-desktop/home/scripts/scripts/nixswitch.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/run/current-system/sw/bin/bash - -scheck && runbg aplay ~/media/sound/sys/nixswitch-start.wav -builtin cd "$HOME/sysflakes" || exit - -nix flake update -sudo nixos-rebuild switch --flake "$HOME/sysflakes#glasshouse-desktop" -if [ $? -eq 0 ]; then - scheck && runbg aplay ~/media/sound/sys/update.wav -else - scheck && runbg aplay ~/media/sound/sys/error.wav -fi -builtin cd "$OLDPWD" || exit diff --git a/glasshouse-desktop/home/scripts/scripts/record.sh b/glasshouse-desktop/home/scripts/scripts/record.sh deleted file mode 100755 index 904ae6b..0000000 --- a/glasshouse-desktop/home/scripts/scripts/record.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env bash - -TMP_FILE_UNOPTIMIZED="/tmp/recording_unoptimized.gif" -TMP_PALETTE_FILE="/tmp/palette.png" -TMP_MP4_FILE="/tmp/recording.mp4" -TMP_GIF_RESULT="/tmp/gif_result" -APP_NAME="Recorder" - -OUT_DIR="$HOME/Videos" -filename=$(date +"%Y-%m-%d_%H-%M-%S") -FILENAME="$OUT_DIR/$filename." - -if [ ! -d "$OUT_DIR" ]; then - mkdir -p "$OUT_DIR" -fi - -is_recorder_running() { - pgrep -x wf-recorder >/dev/null -} - -convert_to_gif() { - ffmpeg -i "$TMP_MP4_FILE" -filter_complex "[0:v] palettegen" "$TMP_PALETTE_FILE" - ffmpeg -i "$TMP_MP4_FILE" -i "$TMP_PALETTE_FILE" -filter_complex "[0:v] fps=10,scale=1400:-1,setpts=0.5*PTS [new];[new][1:v] paletteuse" "$TMP_FILE_UNOPTIMIZED" - if [ -f "$TMP_PALETTE_FILE" ]; then - rm "$TMP_PALETTE_FILE" - fi - if [ -f "$TMP_MP4_FILE" ]; then - rm "$TMP_MP4_FILE" - fi - gifsicle -O3 --lossy=100 -i "$TMP_FILE_UNOPTIMIZED" -o "$TMP_GIF_RESULT" - if [ -f "$TMP_FILE_UNOPTIMIZED" ]; then - rm "$TMP_FILE_UNOPTIMIZED" - fi -} - -notify() { - notify-send -a "$APP_NAME" "$1" "$2" -t 5000 -} - -screen() { - notify "Starting Recording" "Your screen is being recorded" - timeout 600 wf-recorder -F format=rgb24 -x rgb24 -p qp=0 -p crf=0 -p preset=slow -c libx264rgb -f "$TMP_MP4_FILE" -} - -area() { - GEOMETRY=$(slurp) - if [[ ! -z "$GEOMETRY" ]]; then - notify "Starting Recording" "Your screen is being recorded" - timeout 600 wf-recorder -F format=rgb24 -x rgb24 -p qp=0 -p crf=0 -p preset=slow -c libx264rgb -g "$GEOMETRY" -f "$TMP_MP4_FILE" - fi -} - -gif() { - touch /tmp/recording_gif - area -} - -stop() { - if is_recorder_running; then - kill $(pgrep -x wf-recorder) - - if [[ -f /tmp/recording_gif ]] then - notify "Stopped Recording" "Starting GIF conversion phase..." - FILENAME+="gif" - convert_to_gif - SavePath=$( zenity --file-selection --save --file-filter=*.gif --filename="$OUT_DIR"'/.gif' ) - if [ "$SavePath" == "" ]; then - SavePath="$FILENAME" - fi - [[ $SavePath =~ \.gif$ ]] || SavePath+='.gif' - mv $TMP_GIF_RESULT $SavePath - wl-copy -t image/png < $SavePath - notify "GIF conversion completed" "GIF saved to $SavePath" - else - FILENAME+="mp4" - SavePath=$( zenity --file-selection --save --file-filter=*.mp4 --filename="$OUT_DIR"'/.mp4' ) - if [ "$SavePath" == "" ]; then - SavePath="$FILENAME" - fi - [[ $SavePath =~ \.mp4$ ]] || SavePath+='.mp4' - mv $TMP_MP4_FILE $SavePath - wl-copy -t video/mp4 < $SavePath - notify "Stopped Recording" "Video saved to $SavePath" - fi - - [[ -f $TMP_FILE_UNOPTIMIZED ]] && rm -f "$TMP_FILE_UNOPTIMIZED" - [[ -f $TMP_PALETTE_FILE ]] && rm -f "$TMP_PALETTE_FILE" - [[ -f $TMP_GIF_RESULT ]] && rm -f "$TMP_GIF_RESULT" - [[ -f $TMP_MP4_FILE ]] && rm -f "$TMP_MP4_FILE" - [[ -f /tmp/recording_gif ]] && rm -f /tmp/recording_gif - - exit 0 - fi -} - -if is_recorder_running; then - stop -fi - -if [ "$1" != "stop" ]; then - [[ -f $TMP_FILE_UNOPTIMIZED ]] && rm -f "$TMP_FILE_UNOPTIMIZED" - [[ -f $TMP_PALETTE_FILE ]] && rm -f "$TMP_PALETTE_FILE" - [[ -f $TMP_GIF_RESULT ]] && rm -f "$TMP_GIF_RESULT" - [[ -f $TMP_MP4_FILE ]] && rm -f "$TMP_MP4_FILE" - [[ -f /tmp/recording_gif ]] && rm -f /tmp/recording_gif -fi - -case "$1" in - screen) - screen - ;; - area) - area - ;; - gif) - gif - ;; - stop) - stop - ;; - *) - echo "Usage: $0 {screen|area|gif|stop}" - exit 1 - ;; -esac diff --git a/glasshouse-desktop/home/scripts/scripts/rofi-power-menu.sh b/glasshouse-desktop/home/scripts/scripts/rofi-power-menu.sh deleted file mode 100755 index 5ecfb73..0000000 --- a/glasshouse-desktop/home/scripts/scripts/rofi-power-menu.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/usr/bin/env bash - -# This script defines just a mode for rofi instead of being a self-contained -# executable that launches rofi by itself. This makes it more flexible than -# running rofi inside this script as now the user can call rofi as one pleases. -# For instance: -# -# rofi -show powermenu -modi powermenu:./rofi-power-menu -# -# See README.md for more information. - -set -e -set -u - -# All supported choices -all=(shutdown reboot suspend hibernate lockscreen) - -# By default, show all (i.e., just copy the array) -show=("${all[@]}") - -declare -A texts -texts[lockscreen]="lock screen" -texts[switchuser]="switch user" -texts[logout]="log out" -texts[suspend]="suspend" -texts[hibernate]="hibernate" -texts[reboot]="reboot" -texts[shutdown]="shut down" - -declare -A icons -icons[lockscreen]="\Uf033e" -icons[switchuser]="\Uf0019" -icons[logout]="\Uf0343" -icons[suspend]="\Uf04b2" -icons[hibernate]="\Uf02ca" -icons[reboot]="\Uf0709" -icons[shutdown]="\Uf0425" -icons[cancel]="\Uf0156" - -declare -A actions -actions[lockscreen]="hyprlock" -#actions[switchuser]="???" -actions[logout]="sway exit" -actions[suspend]="systemctl suspend" -actions[hibernate]="systemctl hibernate" -actions[reboot]="systemctl reboot" -actions[shutdown]="systemctl poweroff" - -# By default, ask for confirmation for actions that are irreversible -confirmations=(reboot shutdown hibernate) - -# By default, no dry run -dryrun=false -showsymbols=true -showtext=true - -function check_valid { - option="$1" - shift 1 - for entry in "${@}" - do - if [ -z "${actions[$entry]+x}" ] - then - echo "Invalid choice in $1: $entry" >&2 - exit 1 - fi - done -} - -# Parse command-line options -parsed=$(getopt --options=h --longoptions=help,dry-run,confirm:,choices:,choose:,symbols,no-symbols,text,no-text,symbols-font: --name "$0" -- "$@") -if [ $? -ne 0 ]; then - echo 'Terminating...' >&2 - exit 1 -fi -eval set -- "$parsed" -unset parsed -while true; do - case "$1" in - "-h"|"--help") - echo "rofi-power-menu - a power menu mode for Rofi" - echo - echo "Usage: rofi-power-menu [--choices CHOICES] [--confirm CHOICES]" - echo " [--choose CHOICE] [--dry-run] [--symbols|--no-symbols]" - echo - echo "Use with Rofi in script mode. For instance, to ask for shutdown or reboot:" - echo - echo " rofi -show menu -modi \"menu:rofi-power-menu --choices=shutdown/reboot\"" - echo - echo "Available options:" - echo " --dry-run Don't perform the selected action but print it to stderr." - echo " --choices CHOICES Show only the selected choices in the given order. Use /" - echo " as the separator. Available choices are lockscreen," - echo " logout,suspend, hibernate, reboot and shutdown. By" - echo " default, all available choices are shown." - echo " --confirm CHOICES Require confirmation for the gives choices only. Use / as" - echo " the separator. Available choices are lockscreen, logout," - echo " suspend, hibernate, reboot and shutdown. By default, only" - echo " irreversible actions logout, reboot and shutdown require" - echo " confirmation." - echo " --choose CHOICE Preselect the given choice and only ask for a" - echo " confirmation (if confirmation is set to be requested). It" - echo " is strongly recommended to combine this option with" - echo " --confirm=CHOICE if the choice wouldn't require" - echo " confirmation by default. Available choices are" - echo " lockscreen, logout, suspend, hibernate, reboot and" - echo " shutdown." - echo " --[no-]symbols Show Unicode symbols or not. Requires a font with support" - echo " for the symbols. Use, for instance, fonts from the" - echo " Nerdfonts collection. By default, they are shown" - echo " --[no-]text Show text description or not." - echo " --symbols-font FONT Use the given font for symbols. By default, the symbols" - echo " use the same font as the text. That font is configured" - echo " with rofi." - echo " -h,--help Show this help text." - exit 0 - ;; - "--dry-run") - dryrun=true - shift 1 - ;; - "--confirm") - IFS='/' read -ra confirmations <<< "$2" - check_valid "$1" "${confirmations[@]}" - shift 2 - ;; - "--choices") - IFS='/' read -ra show <<< "$2" - check_valid "$1" "${show[@]}" - shift 2 - ;; - "--choose") - # Check that the choice is valid - check_valid "$1" "$2" - selectionID="$2" - shift 2 - ;; - "--symbols") - showsymbols=true - shift 1 - ;; - "--no-symbols") - showsymbols=false - shift 1 - ;; - "--text") - showtext=true - shift 1 - ;; - "--no-text") - showtext=false - shift 1 - ;; - "--symbols-font") - symbols_font="$2" - shift 2 - ;; - "--") - shift - break - ;; - *) - echo "Internal error" >&2 - exit 1 - ;; - esac -done - -if [ "$showsymbols" = "false" -a "$showtext" = "false" ] -then - echo "Invalid options: cannot have --no-symbols and --no-text enabled at the same time." >&2 - exit 1 -fi - -# Define the messages after parsing the CLI options so that it is possible to -# configure them in the future. - -function write_message { - if [ -z ${symbols_font+x} ]; - then - icon="$1" - else - icon="$1" - fi - text="$2" - if [ "$showsymbols" = "true" ] - then - if [ "$showtext" = "true" ] - then - echo -n "\u200e$icon \u2068$text\u2069" - else - echo -n "\u200e$icon" - fi - else - echo -n "$text" - fi -} - -function print_selection { - echo -e "$1" | $(read -r -d '' entry; echo "echo $entry") -} - -declare -A messages -declare -A confirmationMessages -for entry in "${all[@]}" -do - messages[$entry]=$(write_message "${icons[$entry]}" "${texts[$entry]^}") -done -for entry in "${all[@]}" -do - confirmationMessages[$entry]=$(write_message "${icons[$entry]}" "Yes, ${texts[$entry]}") -done -confirmationMessages[cancel]=$(write_message "${icons[cancel]}" "No, cancel") - -if [ $# -gt 0 ] -then - # If arguments given, use those as the selection - selection="${@}" -else - # Otherwise, use the CLI passed choice if given - if [ -n "${selectionID+x}" ] - then - selection="${messages[$selectionID]}" - fi -fi - -# Don't allow custom entries -echo -e "\0no-custom\x1ftrue" -# Use markup -echo -e "\0markup-rows\x1ftrue" - -if [ -z "${selection+x}" ] -then - echo -e "\0prompt\x1fPower menu" - for entry in "${show[@]}" - do - echo -e "${messages[$entry]}\0icon\x1f${icons[$entry]}" - done -else - for entry in "${show[@]}" - do - if [ "$selection" = "$(print_selection "${messages[$entry]}")" ] - then - # Check if the selected entry is listed in confirmation requirements - for confirmation in "${confirmations[@]}" - do - if [ "$entry" = "$confirmation" ] - then - # Ask for confirmation - echo -e "\0prompt\x1fAre you sure" - echo -e "${confirmationMessages[$entry]}\0icon\x1f${icons[$entry]}" - echo -e "${confirmationMessages[cancel]}\0icon\x1f${icons[cancel]}" - exit 0 - fi - done - # If not, then no confirmation is required, so mark confirmed - selection=$(print_selection "${confirmationMessages[$entry]}") - fi - if [ "$selection" = "$(print_selection "${confirmationMessages[$entry]}")" ] - then - if [ $dryrun = true ] - then - # Tell what would have been done - echo "Selected: $entry" >&2 - else - # Perform the action - pkill -9 rofi - ${actions[$entry]} - fi - exit 0 - fi - if [ "$selection" = "$(print_selection "${confirmationMessages[cancel]}")" ] - then - # Do nothing - exit 0 - fi - done - # The selection didn't match anything, so raise an error - echo "Invalid selection: $selection" >&2 - exit 1 -fi diff --git a/glasshouse-desktop/home/scripts/scripts/screenshot.sh b/glasshouse-desktop/home/scripts/scripts/screenshot.sh deleted file mode 100755 index 04df199..0000000 --- a/glasshouse-desktop/home/scripts/scripts/screenshot.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -dir="$HOME/Pictures/Screenshots" -time=$(date +'%Y_%m_%d_at_%Hh%Mm%Ss') -file="${dir}/Screenshot_${time}.png" - -copy() { - grimblast --notify --freeze copy area -} - -save() { - grimblast --notify --freeze save area "$file" -} - -swappy_() { - grimblast --notify --freeze save area "$file" - swappy -f "$file" -} - -if [[ ! -d "$dir" ]]; then - mkdir -p "$dir" -fi - -if [[ "$1" == "--copy" ]]; then - copy -elif [[ "$1" == "--save" ]]; then - save -elif [[ "$1" == "--swappy" ]]; then - swappy_ -else - echo -e "Available Options: --copy --save --swappy" -fi - -exit 0 diff --git a/glasshouse-desktop/home/scripts/scripts/vm-start.sh b/glasshouse-desktop/home/scripts/scripts/vm-start.sh deleted file mode 100755 index ba2fd15..0000000 --- a/glasshouse-desktop/home/scripts/scripts/vm-start.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env zsh - -# VM name -vm_name="win10" -export LIBVIRT_DEFAULT_URI="qemu:///system" - -# change workspace -hyprctl dispatch workspace 6 - -virsh start ${vm_name} -virt-viewer -f -w -a ${vm_name} \ No newline at end of file diff --git a/glasshouse-desktop/home/scripts/scripts/wall-change.sh b/glasshouse-desktop/home/scripts/scripts/wall-change.sh deleted file mode 100755 index 8ec034c..0000000 --- a/glasshouse-desktop/home/scripts/scripts/wall-change.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -PIDS=$(pgrep -f "swaybg") - -swaybg -m fill -i $1 & - -if [ -n "$PIDS" ]; then - echo "$PIDS" | xargs kill -fi diff --git a/glasshouse-desktop/home/scripts/scripts/wallpaper-picker.sh b/glasshouse-desktop/home/scripts/scripts/wallpaper-picker.sh deleted file mode 100755 index 6208123..0000000 --- a/glasshouse-desktop/home/scripts/scripts/wallpaper-picker.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -wallpaper_path=$HOME/Pictures/wallpapers -wallpapers_folder=$HOME/Pictures/Wallpapers -wallpaper_name="$(ls $wallpapers_folder | rofi -dmenu || pkill rofi)" -if [[ -f $wallpapers_folder/$wallpaper_name ]]; then - find ~/Pictures/Wallpapers -maxdepth 1 -type f -delete - cp $wallpapers_folder/$wallpaper_name $wallpaper_path/$wallpaper_name - wall-change $wallpaper_path/$wallpaper_name -else - exit 1 -fi diff --git a/glasshouse-desktop/home/scripts/scripts/shutdown-script.sh b/glasshouse-desktop/home/scripts/shutdown-script.nix old mode 100755 new mode 100644 similarity index 79% rename from glasshouse-desktop/home/scripts/scripts/shutdown-script.sh rename to glasshouse-desktop/home/scripts/shutdown-script.nix index 9b5c99c..c0e3e3e --- a/glasshouse-desktop/home/scripts/scripts/shutdown-script.sh +++ b/glasshouse-desktop/home/scripts/shutdown-script.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "shutdown-script" ('' #!/usr/bin/env zsh respond="$(echo " Shutdown\n Restart\n Cancel" | rofi -dmenu)" @@ -13,3 +17,4 @@ then else notify-send "cancel shutdown" fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/splash.sh b/glasshouse-desktop/home/scripts/splash.nix old mode 100755 new mode 100644 similarity index 75% rename from glasshouse-desktop/home/scripts/scripts/splash.sh rename to glasshouse-desktop/home/scripts/splash.nix index 4cc0508..e5184fa --- a/glasshouse-desktop/home/scripts/scripts/splash.sh +++ b/glasshouse-desktop/home/scripts/splash.nix @@ -1,6 +1,12 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "splash" ('' #!/bin/bash echo "NixOS kernel ver. $(uname -a | awk '{print $3}') x86_64 GNU/Linux" date +"%A %B %-d %Y" echo -e "\033[38;2;0;180;205m$(toilet -t -f Slant.flf glasshouse)\033[0m" echo +'') + diff --git a/glasshouse-desktop/home/scripts/scripts/switchmon.sh b/glasshouse-desktop/home/scripts/switchmon.nix old mode 100755 new mode 100644 similarity index 66% rename from glasshouse-desktop/home/scripts/scripts/switchmon.sh rename to glasshouse-desktop/home/scripts/switchmon.nix index c7be2ab..95bedd8 --- a/glasshouse-desktop/home/scripts/scripts/switchmon.sh +++ b/glasshouse-desktop/home/scripts/switchmon.nix @@ -1,3 +1,8 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "switchmon" ('' #!/bin/zsh hyprctl dispatch focusmonitor $(echo "$(hyprctl -j monitors)" | jq -r '.[] | select(.focused == false) | .name') + '') diff --git a/glasshouse-desktop/home/scripts/scripts/toggle_blur.sh b/glasshouse-desktop/home/scripts/toggle_blur.nix old mode 100755 new mode 100644 similarity index 77% rename from glasshouse-desktop/home/scripts/scripts/toggle_blur.sh rename to glasshouse-desktop/home/scripts/toggle_blur.nix index 9e970a4..db3d4f1 --- a/glasshouse-desktop/home/scripts/scripts/toggle_blur.sh +++ b/glasshouse-desktop/home/scripts/toggle_blur.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "toggle_blur" ('' #!/usr/bin/env bash if hyprctl getoption decoration:blur:enabled | grep "int: 1" >/dev/null ; then @@ -5,3 +9,4 @@ if hyprctl getoption decoration:blur:enabled | grep "int: 1" >/dev/null ; then else hyprctl keyword decoration:blur:enabled true >/dev/null fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/toggle_float.sh b/glasshouse-desktop/home/scripts/toggle_float.nix old mode 100755 new mode 100644 similarity index 65% rename from glasshouse-desktop/home/scripts/scripts/toggle_float.sh rename to glasshouse-desktop/home/scripts/toggle_float.nix index dadb982..172d409 --- a/glasshouse-desktop/home/scripts/scripts/toggle_float.sh +++ b/glasshouse-desktop/home/scripts/toggle_float.nix @@ -1,5 +1,10 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "toggle_float" ('' #!/usr/bin/env bash hyprctl dispatch togglefloating hyprctl dispatch resizeactive exact 950 600 hyprctl dispatch centerwindow + '') diff --git a/glasshouse-desktop/home/scripts/scripts/toggle_oppacity.sh b/glasshouse-desktop/home/scripts/toggle_oppacity.nix old mode 100755 new mode 100644 similarity index 83% rename from glasshouse-desktop/home/scripts/scripts/toggle_oppacity.sh rename to glasshouse-desktop/home/scripts/toggle_oppacity.nix index 9f1062e..faa02c8 --- a/glasshouse-desktop/home/scripts/scripts/toggle_oppacity.sh +++ b/glasshouse-desktop/home/scripts/toggle_oppacity.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "toggle_oppacity" ('' #!/usr/bin/env bash if hyprctl getoption decoration:active_opacity | grep "float: 1" >/dev/null ; then @@ -7,3 +11,4 @@ else hyprctl keyword decoration:active_opacity 1 >/dev/null hyprctl keyword decoration:inactive_opacity 1 >/dev/null fi + '') diff --git a/glasshouse-desktop/home/scripts/scripts/toggle_waybar.sh b/glasshouse-desktop/home/scripts/toggle_waybar.nix old mode 100755 new mode 100644 similarity index 65% rename from glasshouse-desktop/home/scripts/scripts/toggle_waybar.sh rename to glasshouse-desktop/home/scripts/toggle_waybar.nix index b1de075..6528b24 --- a/glasshouse-desktop/home/scripts/scripts/toggle_waybar.sh +++ b/glasshouse-desktop/home/scripts/toggle_waybar.nix @@ -1,3 +1,7 @@ +{ self, pkgs }: + + +pkgs.writeShellScriptBin "toggle_waybar" ('' #!/usr/bin/env bash SERVICE=".waybar-wrapped" @@ -8,3 +12,4 @@ then else runbg waybar fi + '')