add screenshot script and binds

This commit is contained in:
lucy 2026-06-17 20:18:18 +02:00
commit 854f0629c1
7 changed files with 35 additions and 17 deletions

View file

@ -43,8 +43,7 @@ install: all
mkdir -p ${DESTDIR}${MANPREFIX}/man1 mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
cp -f dwm-launcher ${DESTDIR}${PREFIX}/bin cp active_screenshot.sh ${DESTDIR}${PREFIX}/bin
cp -f dwm.desktop /usr/share/xsessions/
uninstall: uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/dwm\ rm -f ${DESTDIR}${PREFIX}/bin/dwm\

28
active_screenshot.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
MONITORS=$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')
# Get the location of the mouse
XMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $2}')
YMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $4}')
for mon in ${MONITORS}; do
# Parse the geometry of the monitor
MONW=$(echo ${mon} | awk -F "[x+]" '{print $1}')
MONH=$(echo ${mon} | awk -F "[x+]" '{print $2}')
MONX=$(echo ${mon} | awk -F "[x+]" '{print $3}')
MONY=$(echo ${mon} | awk -F "[x+]" '{print $4}')
# Use a simple collision check
if (( ${XMOUSE} >= ${MONX} )); then
if (( ${XMOUSE} <= ${MONX}+${MONW} )); then
if (( ${YMOUSE} >= ${MONY} )); then
if (( ${YMOUSE} <= ${MONY}+${MONH} )); then
# We have found our monitor!
maim -g "${MONW}x${MONH}+${MONX}+${MONY}" | xclip -selection clipboard -t image/png
exit 0
fi
fi
fi
fi
done
echo "Oh no the mouse is in the void!"
exit 1

View file

@ -6,8 +6,8 @@ static unsigned int gappx = 10; /* gaps between windows */
static unsigned int snap = 32; /* snap pixel */ static unsigned int snap = 32; /* snap pixel */
static int showbar = 1; /* 0 means no bar */ static int showbar = 1; /* 0 means no bar */
static int topbar = 0; /* 0 means bottom bar */ static int topbar = 0; /* 0 means bottom bar */
static const char *fonts[] = { "Maple Mono NL:size=10" }; static const char *fonts[] = { "Iosevka Custom:size=10" };
static const char dmenufont[] = "Maple Mono NL:size=10"; static const char dmenufont[] = "Iosevka Custom:size=10";
static char normbgcolor[] = "#222222"; static char normbgcolor[] = "#222222";
static char normbordercolor[] = "#444444"; static char normbordercolor[] = "#444444";
static char normfgcolor[] = "#bbbbbb"; static char normfgcolor[] = "#bbbbbb";
@ -126,7 +126,10 @@ static Key keys[] = {
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } },
{ 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("maim -s | xclip -selection clipboard -t image/png"), }, { MODKEY|ShiftMask, XK_s, spawn, SHCMD("maim -s -B | xclip -selection clipboard -t image/png"), },
{ Mod1Mask|ShiftMask, XK_s, spawn, SHCMD("active_screenshot.sh"), },
{ MODKEY|ShiftMask, XK_w, spawn, SHCMD("feh --bg-fill ~/.walls/$(ls ~/.walls | dmenu)"), },
{ MODKEY|ShiftMask, XK_t, spawn, SHCMD("tinty apply $(tinty list | dmenu)"), },
}; };
/* button definitions */ /* button definitions */

BIN
dwm

Binary file not shown.

View file

@ -1,7 +0,0 @@
#!/bin/bash
export XCURSOR_THEME=Adwaita
export XCURSOR_SIZE=24
export GTK_THEME=adw-gtk3-dark
xrdb -load $HOME/.Xressources
dbus-run-session dwm

View file

@ -1,5 +0,0 @@
[Desktop Entry]
Name=dwm
Comment=dynamic window manager
Exec=dbus-run-session dwm-launcher
Type=Application

BIN
dwm.o

Binary file not shown.