From 4a2dc0c95bf6f0c5d5f28b566f5d99a5111f9a7d Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 14:10:35 +0100 Subject: [PATCH] feat(dwm): screenshots --- files/dwm/config.h | 17 ++++++++++++++--- files/dwm/dwm-start.sh | 1 + scripts/30-dwm.sh | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index dc4b931..0cf9a63 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -3,7 +3,7 @@ #include /* appearance */ -static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ @@ -62,20 +62,29 @@ static const Layout layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ + +// dmenu static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +// terminal static const char *termcmd[] = { "alacritty", NULL }; -static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; +// general & sys +static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; - static const char *light_up[] = {"light", "-A", "5", NULL}; static const char *light_down[] = {"light", "-U", "5", NULL}; +// screenshots +static const char *screenshot[] = {"flameshot", "full", "-c", NULL}; +static const char *screenshot_partial[] = {"flameshot", "gui", "-c", NULL}; + +// kill dwm static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; + static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_Return, spawn, {.v = termcmd } }, @@ -101,6 +110,8 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { 0, XK_Print, spawn, {.v = screenshot } }, + { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 40bf68f..a6b9372 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -26,6 +26,7 @@ done & nm-applet & mate-volume-control-status-icon & +flameshot & feh -z -Z --bg-scale /home/didier/Pictures/background.png exec dwm >/dev/null diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 6813bc5..30a2e78 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -8,7 +8,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ network-manager-applet \ alsa-utils \ dstat \ - curl + curl \ + flameshot # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm @@ -31,4 +32,4 @@ chmod +x ./files/dwm/dwm-start.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start # DM entry -$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop \ No newline at end of file +$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop