diff --git a/scripts/color_picker b/scripts/color_picker new file mode 100755 index 0000000..e0ac75f --- /dev/null +++ b/scripts/color_picker @@ -0,0 +1,10 @@ +#!/bin/sh + +set -xe + +grim -g "$(slurp -b aabbcc00 -p)" - | + convert - txt:- | + grep -oE '#[0-9A-Fa-f]{6}' | + wl-copy -n + +notify-send "$(wl-paste)" "Copied to clipboard" diff --git a/scripts/default.nix b/scripts/default.nix index 8c3b300..44e7f23 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -40,6 +40,7 @@ create_scripts [ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ]; volumesh = [ pulseaudio libnotify ]; pulse_sink = [ pulseaudio pamixer final.wdmenu ]; + color_picker = [ grim slurp wl-clipboard libnotify imagemagick ]; } // lib.mapAttrs import_script { wdmenu = ./wdmenu.nix; wlauncher = ./wlauncher.nix; diff --git a/user/sway.nix b/user/sway.nix index 6b63c9f..76c8abb 100644 --- a/user/sway.nix +++ b/user/sway.nix @@ -2,14 +2,6 @@ let inherit (pkgs.uservars) key accent font theme; inherit (theme) color; - color_picker = pkgs.writeShellScript "color_picker" '' - grim -g "$(slurp -b aabbcc00 -p)" - | - convert - txt:- | - grep -oE '#[0-9A-Fa-f]{6}' | - wl-copy -n - - notify-send "$(wl-paste)" "Copied to clipboard" - ''; _lock = pkgs.writeShellScriptBin "_lock" '' ${pkgs.swaylock}/bin/swaylock -f systemctl --user start swayidle.service @@ -327,7 +319,7 @@ in "${mod}+p" = "exec ${pkgs.wpass}/bin/wpass"; "${mod}+s" = "exec ${menu}"; "${mod}+g" = "exec ${pkgs.demoji}/bin/demoji --lang pt --fallback --copy -- ${pkgs.wdmenu}/bin/wdmenu"; - "${mod}+c" = "exec ${color_picker}"; + "${mod}+c" = "exec ${pkgs.color_picker}/bin/color_picker"; "${mod}+Return" = "exec ${terminal}"; "${mod}+Ctrl+Return" = "exec thunar"; "${mod}+Shift+s" = "exec grim - | swappy -f -"; @@ -491,6 +483,7 @@ in libnotify xdg-utils screenshotsh + color_picker wf-recorder wl-clipboard wtype