scripts: extract color_picker from sway

This commit is contained in:
Leonardo Eugênio 2023-02-25 17:03:00 -03:00
parent 313a8e168a
commit caa4495215
3 changed files with 13 additions and 9 deletions

10
scripts/color_picker Executable file
View file

@ -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"

View file

@ -40,6 +40,7 @@ create_scripts
[ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ]; [ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ];
volumesh = [ pulseaudio libnotify ]; volumesh = [ pulseaudio libnotify ];
pulse_sink = [ pulseaudio pamixer final.wdmenu ]; pulse_sink = [ pulseaudio pamixer final.wdmenu ];
color_picker = [ grim slurp wl-clipboard libnotify imagemagick ];
} // lib.mapAttrs import_script { } // lib.mapAttrs import_script {
wdmenu = ./wdmenu.nix; wdmenu = ./wdmenu.nix;
wlauncher = ./wlauncher.nix; wlauncher = ./wlauncher.nix;

View file

@ -2,14 +2,6 @@
let let
inherit (pkgs.uservars) key accent font theme; inherit (pkgs.uservars) key accent font theme;
inherit (theme) color; 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" '' _lock = pkgs.writeShellScriptBin "_lock" ''
${pkgs.swaylock}/bin/swaylock -f ${pkgs.swaylock}/bin/swaylock -f
systemctl --user start swayidle.service systemctl --user start swayidle.service
@ -327,7 +319,7 @@ in
"${mod}+p" = "exec ${pkgs.wpass}/bin/wpass"; "${mod}+p" = "exec ${pkgs.wpass}/bin/wpass";
"${mod}+s" = "exec ${menu}"; "${mod}+s" = "exec ${menu}";
"${mod}+g" = "exec ${pkgs.demoji}/bin/demoji --lang pt --fallback --copy -- ${pkgs.wdmenu}/bin/wdmenu"; "${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}+Return" = "exec ${terminal}";
"${mod}+Ctrl+Return" = "exec thunar"; "${mod}+Ctrl+Return" = "exec thunar";
"${mod}+Shift+s" = "exec grim - | swappy -f -"; "${mod}+Shift+s" = "exec grim - | swappy -f -";
@ -491,6 +483,7 @@ in
libnotify libnotify
xdg-utils xdg-utils
screenshotsh screenshotsh
color_picker
wf-recorder wf-recorder
wl-clipboard wl-clipboard
wtype wtype