From 3fe7b84378ad83798201d6bfc2f50a5d70b5a55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20=C3=87olako=C4=9Flu?= Date: Wed, 17 Mar 2021 14:00:09 +0300 Subject: [PATCH] Auto reload dwm --- scripts/dmenu-logout | 2 +- scripts/tedportal | 10 ++++++++++ suckless/dwm/keybind.h | 3 +++ suckless/dwm/rules.h | 2 +- xorg/xinitrc | 16 +++++++++++++++- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 scripts/tedportal diff --git a/scripts/dmenu-logout b/scripts/dmenu-logout index 87a1097e..f0b62a57 100755 --- a/scripts/dmenu-logout +++ b/scripts/dmenu-logout @@ -43,7 +43,7 @@ case $selection in restart ;; logout) - logout + kill -9 $(pidof dwm) ;; hibernate) sudo systemctl hibernate diff --git a/scripts/tedportal b/scripts/tedportal new file mode 100755 index 00000000..c1134646 --- /dev/null +++ b/scripts/tedportal @@ -0,0 +1,10 @@ +#!/bin/bash + +selection=$(cat ~/.cache/tedportal | dmenu -i -l 8) +echo $selection + +IFS="|" + +read -ra url <<< "$selection" + +xdg-open ${url[1]} diff --git a/suckless/dwm/keybind.h b/suckless/dwm/keybind.h index eef8809a..7770581b 100644 --- a/suckless/dwm/keybind.h +++ b/suckless/dwm/keybind.h @@ -34,6 +34,8 @@ static const char *notification_on[] = {"/home/yigit/.scripts/dunst_toggle.sh", static const char *screensaver_off[] = {"/home/yigit/.scripts/screensaver_toggle","-s",NULL}; static const char *screensaver_on[] = {"/home/yigit/.scripts/screensaver_toggle", "-e",NULL}; +static const char *online_class[] = {"/home/yigit/.scripts/tedportal",NULL}; + static const char *bwmenu[] = {"/home/yigit/.scripts/password_manager", NULL}; @@ -121,6 +123,7 @@ static Key keys[] = { { MODKEY, XK_Print, spawn, {.v = windowshot } }, { MODKEY, XK_u, spawn, {.v = url} }, { MODKEY, XK_g, spawn, {.v = google} }, + { MODKEY|ShiftMask, XK_c, spawn, {.v = online_class} }, { MODKEY, XK_y, spawn, {.v = youtube} }, { MODKEY, XK_s, togglescratch, {.ui = 0 } }, { MODKEY|ShiftMask, XK_s, togglescratch, {.ui = 1 } }, diff --git a/suckless/dwm/rules.h b/suckless/dwm/rules.h index 8ead2390..3aaaf95c 100644 --- a/suckless/dwm/rules.h +++ b/suckless/dwm/rules.h @@ -29,6 +29,6 @@ static const Rule rules[] = { RULE(.class = "ranger", 0, .isfloating = 1) RULE(.class = "vim", 0, .isfloating = 1, .floatpos="50% 50% 800W 560H") RULE(.class = "mpv", 0, .isfloating = 1, .floatpos="100% 1% 600W 350H") - RULE(.class = "Sxiv", 0, .isfloating = 1, .floatpos="100% 1% 600W 350H") + RULE(.instance = "sxiv", 0, .isfloating = 1, .floatpos="100% 1% 600W 350H") RULE(.class = "neomutt-send", 0, .isfloating = 1, .floatpos="50% 50% 1000W 700H") }; diff --git a/xorg/xinitrc b/xorg/xinitrc index 488b13f6..8234d444 100755 --- a/xorg/xinitrc +++ b/xorg/xinitrc @@ -57,4 +57,18 @@ bitwarden-desktop & #thunderbird & dunst & -exec dwm > /tmp/dwm.log 2> /tmp/dwm.err + +csum="" +new_csum=$(sha1sum $(which dwm)) +while true +do + if [ "$csum" != "$new_csum" ] + then + csum=$new_csum + dwm > /tmp/dwm.log 2> /tmp/dwm.err + else + exit 0 + fi + new_csum=$(sha1sum $(which dwm)) + sleep 0.5 +done