diff --git a/scripts/dunst_toggle.sh b/scripts/dunst_toggle.sh index 0634ccef..448a5d66 100755 --- a/scripts/dunst_toggle.sh +++ b/scripts/dunst_toggle.sh @@ -9,9 +9,11 @@ getargs() { done } start_dnd() { + echo "off" > ~/.cache/dunst notify-send "DUNST_COMMAND_PAUSE"; } end_dnd() { + echo "on" > ~/.cache/dunst notify-send "DUNST_COMMAND_RESUME"; notify-send "Do Not Disturb" "Do Not Disturb mode ended. Notifications will be shown."; } @@ -19,5 +21,6 @@ main() { getargs "$@"; [[ "$start" ]] && start_dnd; [[ "$end" ]] && end_dnd; + kill -52 $(pidof dwmblocks) } main "$@" diff --git a/scripts/screensaver_toggle b/scripts/screensaver_toggle new file mode 100755 index 00000000..d7a3dea5 --- /dev/null +++ b/scripts/screensaver_toggle @@ -0,0 +1,27 @@ +#!/bin/zsh +getargs() { + while getopts "se" opt + do + case $opt in + s) start="true";; + e) end="true";; + esac + done +} +start_dnd() { + xset -dpms + echo "off" > ~/.cache/screensaver + notify-send "Screensaver off"; +} +end_dnd() { + xset +dpms + echo "on" > ~/.cache/screensaver + notify-send "Screensaver on."; +} +main() { + getargs "$@"; + [[ "$start" ]] && start_dnd; + [[ "$end" ]] && end_dnd; + kill -53 $(pidof dwmblocks) +} +main "$@" diff --git a/scripts/status-bar/dunst b/scripts/status-bar/dunst new file mode 100755 index 00000000..c7509f7d --- /dev/null +++ b/scripts/status-bar/dunst @@ -0,0 +1,9 @@ +#!/bin/bash + +stats=$(<~/.cache/dunst) + +if [ "$stats" = "off" ]; then + echo "^c#88c0d0^ ^d^" +else + echo "^c#88c0d0^ ^d^" +fi diff --git a/scripts/status-bar/screensaver b/scripts/status-bar/screensaver new file mode 100755 index 00000000..226d82fa --- /dev/null +++ b/scripts/status-bar/screensaver @@ -0,0 +1,9 @@ +#!/bin/bash + +stats=$(<~/.cache/screensaver) + +if [ "$stats" = "off" ]; then + echo "^c#a48ead^ ^d^" +else + echo "^c#a48ead^ ^d^" +fi diff --git a/scripts/status-bar/weather b/scripts/status-bar/weather index 931a0077..0646b274 100755 --- a/scripts/status-bar/weather +++ b/scripts/status-bar/weather @@ -10,7 +10,7 @@ getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} # display them with coresponding emojis. showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/\^c#81a1c1\^  \^d\^/g;1q" | tr -d '\n')" -sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ﰕ " $1 "° 滛 " $2 "°"}' ;} +sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ^c#ebcb8b^ 滛^d^ "$2 "°"}' ;} case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; diff --git a/suckless/dwm/keybind.h b/suckless/dwm/keybind.h index 9e571abc..eef8809a 100644 --- a/suckless/dwm/keybind.h +++ b/suckless/dwm/keybind.h @@ -31,6 +31,9 @@ static const char *outmenu[] = {"/home/yigit/.scripts/dmenu-logout"}; static const char *notification_off[] = {"/home/yigit/.scripts/dunst_toggle.sh","-s",NULL}; static const char *notification_on[] = {"/home/yigit/.scripts/dunst_toggle.sh", "-e",NULL}; +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 *bwmenu[] = {"/home/yigit/.scripts/password_manager", NULL}; @@ -42,8 +45,7 @@ static const char *kdeconnect[] = {"/home/yigit/.local/bin/dmenu_kdeconnect.sh", static const char *bluetooth[] = {"/home/yigit/.scripts/dmenu-bluetooth", NULL}; -static const char *screenshot[] = { "scrot","-d","3", "%Y-%m-%d-%s_$wx$h.jpg", "-e","xclip -selection clipboard -t image/jpg < $f; mv $f ~/Pictures/Screenshots/;dunstify --icon='/home/yigit/.icons/Numix-Circle/48/apps/camera.svg' -a 'SNAP' 'Screenshot taken'", NULL }; -static const char *windowshot[] = { "scrot", "-u", "-d","3", "%Y-%m-%d-%s_$wx$h.jpg", "-e","xclip -selection clipboard -t image/jpg < $f; mv $f ~/Pictures/Screenshots/;dunstify --icon='/home/yigit/.icons/Numix-Circle/48/apps/camera.svg' -a 'SNAP' 'Screenshot taken'", NULL }; +static const char *screenshot[] = { "scrot","-d","3", "%Y-%m-%d-%s_$wx$h.jpg", "-e","xclip -selection clipboard -t image/jpg < $f; mv $f ~/Pictures/Screenshots/;dunstify --icon='/home/yigit/.icons/Numix-Circle/48/apps/camera.svg' -a 'SNAP' 'Screenshot taken'", NULL }; static const char *windowshot[] = { "scrot", "-u", "-d","3", "%Y-%m-%d-%s_$wx$h.jpg", "-e","xclip -selection clipboard -t image/jpg < $f; mv $f ~/Pictures/Screenshots/;dunstify --icon='/home/yigit/.icons/Numix-Circle/48/apps/camera.svg' -a 'SNAP' 'Screenshot taken'", NULL }; static const char *url[] = {"/home/yigit/.scripts/dmenu_surf", NULL}; static const char *surf[] = {"/home/yigit/.scripts/tabbed_surf", NULL}; @@ -58,6 +60,8 @@ static Key keys[] = { { MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_i, spawn, {.v = screensaver_off} }, + { MODKEY|ShiftMask, XK_i, spawn, {.v = screensaver_on } }, { MODKEY, XK_n, spawn, {.v = notification_off} }, { MODKEY|ShiftMask, XK_n, spawn, {.v = notification_on } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, diff --git a/suckless/dwmblocks/config.h b/suckless/dwmblocks/config.h index f51919b9..b5f03361 100644 --- a/suckless/dwmblocks/config.h +++ b/suckless/dwmblocks/config.h @@ -4,6 +4,8 @@ static Block blocks[] = { // { "", PATH("clipboard"), 30, 18}, + { "", PATH("screensaver"), 120, 19}, + { "", PATH("dunst"), 120, 18}, { "", PATH("cpu-temp"), 30, 17}, { "", PATH("weather"), 60, 16}, { "", PATH("arch"), 120, 15}, diff --git a/xorg/xinitrc b/xorg/xinitrc index 1b7acdda..488b13f6 100755 --- a/xorg/xinitrc +++ b/xorg/xinitrc @@ -47,6 +47,8 @@ xss-lock -- betterlockscreen -l -t 'Stay the fuck out!' & # aw-server & # aw-watcher-window & # aw-watcher-afk & +echo "on" > ~/.cache/dunst +echo "on" > ~/.cache/screensaver dbus-update-activation-environment --systemd DISPLAY picom --no-fading-openclose & firefox-developer-edition app.daily.dev&