From aed83e24ca055be549146564d79844e760289465 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 26 Mar 2025 08:33:02 -0400 Subject: [PATCH] dwm: add capture area keybind Now the screenshot keybinds are in sync with Hyprland. --- home/dwm.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/home/dwm.nix b/home/dwm.nix index 656f3ef0..fb371817 100644 --- a/home/dwm.nix +++ b/home/dwm.nix @@ -18,6 +18,7 @@ let barScript = "dwm/bar.fish"; wallpaperScript = "dwm/wallpaper.fish"; + areaScript = "dwm/area.fish"; in { home = { @@ -25,6 +26,7 @@ in feh xclip scrot + maim mpdris2 (dwm.override { @@ -100,6 +102,7 @@ in static const char *mute_vol[] = { "${dunst-scripts}/bin/mv-mute", NULL }; static const char *mute_mic[] = { "${dunst-scripts}/bin/mv-mic", NULL }; static const char *wallpaper[] = { "fish", "${homeDirectory}/.config/${wallpaperScript}", NULL }; + static const char *area[] = { "fish", "${homeDirectory}/.config/${areaScript}", NULL }; static const char *audio_prev[] = { "playerctl", "-p", "playerctld", "previous", NULL }; static const char *audio_next[] = { "playerctl", "-p", "playerctld", "next", NULL }; static const char *audio_play_pause[] = { "playerctl", "-p", "playerctld", "play-pause", NULL }; @@ -119,7 +122,7 @@ in { 0, XF86XK_AudioPause, spawn, {.v = audio_play_pause } }, { 0, XF86XK_AudioForward, spawn, {.v = audio_forward } }, { 0, XF86XK_AudioRewind, spawn, {.v = audio_rewind } }, - { 0, XK_Print, spawn, {.v = print } }, + { 0, XK_Print, spawn, {.v = area } }, { MODKEY, XK_bracketleft, spawn, {.v = dmenucmd } }, { MODKEY, XK_bracketright, spawn, {.v = explorercmd } }, { MODKEY, XK_o, togglebar, {0} }, @@ -128,6 +131,7 @@ in { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_m, tagmon, {.i = +1 } }, + { MODKEY, XK_p, spawn, {.v = print } }, { MODKEY, XK_w, spawn, {.v = wallpaper } }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, @@ -266,5 +270,15 @@ in end ''; }; + + ${areaScript} = { + executable = true; + text = # fish + '' + #!/usr/bin/env fish + + maim -s | xclip -selection clipboard -t image/png + ''; + }; }; }