diff --git a/modules/home/environment/hyprland/config.nix b/modules/home/environment/hyprland/config.nix index 7731dcb..fbb4b25 100644 --- a/modules/home/environment/hyprland/config.nix +++ b/modules/home/environment/hyprland/config.nix @@ -1,12 +1,16 @@ { username, host, - scheme, ... }: let desktop = (host == "oganesson"); + screenshot_bind = if desktop then [ # My laptop does not have a printscreen button + "super, print, exec, grimblast copy area" + ] else [ + "super, insert, exec, grimblast copy area" + ]; in { wayland.windowManager.hyprland = { @@ -24,7 +28,8 @@ in exec-once = [ "waybar &" "swaync &" - "wl-paste --watch cliphist store &" + "wl-paste --type text --watch cliphist store &" + "wl-paste --type image --watch cliphist store &" "wl-clip-persist --clipboard both" "systemctl --user import-environment &" "hash dbus-update-activation-environment 2>/dev/null &" @@ -166,7 +171,6 @@ in bind = [ "super, up, exec, pactl set-sink-volume @default_sink@ +10%" "super, down, exec, pactl set-sink-volume @default_sink@ -10%" - "super, print, exec, grimblast copy area" "super, t, exec, swaync-client -t -sw" "super, a, exec, firefox" "super, q, exec, kitty --title Kitty" @@ -203,7 +207,7 @@ in "super shift, 6, movetoworkspace, 6" "super, s, togglespecialworkspace, magic" "super shift, s, movetoworkspace, special:magic" - ]; + ] ++ screenshot_bind; bindm = [ "super, mouse:272, movewindow" "super, mouse:273, resizewindow" diff --git a/modules/home/scripts/commands/toolbelt.nix b/modules/home/scripts/commands/toolbelt.nix index 5519dac..8d6688d 100644 --- a/modules/home/scripts/commands/toolbelt.nix +++ b/modules/home/scripts/commands/toolbelt.nix @@ -1,25 +1,19 @@ { pkgs, ... }: pkgs.writeShellScriptBin "toolbelt" '' -calc() { - echo "Give me some math" - read input - - answer=$(echo "$input" | bc) - - if [ "$input" = "9+10" ] \ - || [ "$input" = "9 +10" ] \ - || [ "$input" = "9+ 10" ] \ - || [ "$input" = "9 + 10" ]; then - answer="21" - fi - echo "$input = $answer" - echo "$answer" | wl-copy - echo "answer copied to clipboard. press any key to exit." - read -n 1 -s -} - hostname=$(cat /etc/hostname) + +cliphistory() { +cliphist list | fzf --preview=" + index=\$(echo {} | awk '{print \$1}'); \ + mime=\$(cliphist decode \$index | file -i -); \ + if echo \"\$mime\" | grep -q 'image'; then \ + echo \$(cliphist list | rg \"^\$index\" | cut -d ' ' -f 2- | fmt -w 30); \ + else \ + cliphist decode \"\$index\" | fmt -w 30; \ + fi +" --prompt="> " | wl-copy +} btop_cmd() { if [ "$hostname" = 'oganesson' ]; then hyprctl dispatch resizeactive 20% 140% && @@ -44,12 +38,21 @@ declare -A commands=( ["Open System Monitor"]="hyprctl dispatch resizeactive 20% 140% && moveonscreen --center && btop_cmd && hyprctl dispatch resizeactive exact 40% 25% && moveonscreen" ["Open Volume Controls"]="hyprctl dispatch resizeactive 10% 80% && moveonscreen --center && alsamixer && hyprctl dispatch resizeactive exact 40% 25% && moveonscreen" ["Open Keyring"]="hyprctl dispatch resizeactive -300 0 && moveonscreen && if keyring; then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi" - ["Calculator"]="calc" + ["View Clipboard History"]="hyprctl dispatch resizeactive 45% 120% && moveonscreen --center && if cliphistory;then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi" +) + +ordered_commands=( + "Open Keyring" + "Open System Monitor" + "Open Volume Controls" + "Change Wallpaper" + "Change System Color Scheme" + "View Clipboard History" ) # Use fzf to select a command with preview while $running; do -selected_command=$(printf "%s\n" "''${!commands[@]}" | fzf --preview=" +selected_command=$(printf "%s\n" "''${ordered_commands[@]}" | fzf --preview=" cleaned_key=\$(echo {} | tr -d \"'\"); \ echo \"Cleaned key: \$cleaned_key\"; \ declare -A descriptions=( @@ -58,7 +61,7 @@ declare -A descriptions=( [\"Open System Monitor\"]=\"Opens a btop window.\" [\"Open Volume Controls\"]=\"Opens alsamixer.\" [\"Open Keyring\"]=\"Opens a fuzzy finder with all of the paths held in ~/.password-store. Selecting one uses pass to copy that password to the clipboard. Password is cleared from clipboard history after 45 seconds.\" - [\"Calculator\"]=\"Wrapper for bc. Output is copied to the clipboard.\" + [\"View Clipboard History\"]=\"Opens clipboard history. Selecting an item copies it to the clipboard.\" ); \ if [[ -v descriptions[\$cleaned_key] ]]; then \ clear; \ diff --git a/modules/sys/software/packages.nix b/modules/sys/software/packages.nix index 14a7a13..b5c7f6b 100644 --- a/modules/sys/software/packages.nix +++ b/modules/sys/software/packages.nix @@ -12,6 +12,7 @@ cabal-install clang clang-tools + cliphist cmake fail2ban feh