Browse Source

Scripts

main
Yiğit Çolakoğlu 4 years ago
parent
commit
c87dd5f7f3
4 changed files with 34 additions and 14 deletions
  1. +15
    -3
      scripts/dunst_toggle.sh
  2. +13
    -1
      scripts/screensaver_toggle
  3. +2
    -2
      scripts/status-bar/screensaver
  4. +4
    -8
      suckless/dwm/keybind.h

+ 15
- 3
scripts/dunst_toggle.sh View File

@ -1,26 +1,38 @@
#!/bin/zsh
getargs() {
while getopts "se" opt
while getopts "set" opt
do
case $opt in
s) start="true";;
e) end="true";;
t) toggle="true";;
esac
done
}
start_dnd() {
echo "off" > ~/.cache/dunst
dunstctl set-paused false
dunstctl set-paused true
}
end_dnd() {
echo "on" > ~/.cache/dunst
dunstctl set-paused true
dunstctl set-paused false
notify-send "Do Not Disturb" "Do Not Disturb mode ended. Notifications will be shown.";
}
toggle_dnd() {
if [ $(cat ~/.cache/dunst) = "on" ]; then
start_dnd
else
end_dnd
fi
}
main() {
getargs "$@";
[[ "$start" ]] && start_dnd;
[[ "$end" ]] && end_dnd;
[[ "$toggle" ]] && toggle_dnd;
kill -52 $(pidof dwmblocks)
}
main "$@"

+ 13
- 1
scripts/screensaver_toggle View File

@ -1,10 +1,11 @@
#!/bin/zsh
getargs() {
while getopts "se" opt
while getopts "set" opt
do
case $opt in
s) start="true";;
e) end="true";;
t) toggle="true";;
esac
done
}
@ -18,10 +19,21 @@ end_dnd() {
echo "on" > ~/.cache/screensaver
notify-send "Screensaver on.";
}
toggle_dnd() {
if [ $(cat ~/.cache/screensaver) = "on" ]; then
start_dnd
else
end_dnd
fi
}
main() {
getargs "$@";
[[ "$start" ]] && start_dnd;
[[ "$end" ]] && end_dnd;
[[ "$toggle" ]] && toggle_dnd;
kill -53 $(pidof dwmblocks)
}
main "$@"

+ 2
- 2
scripts/status-bar/screensaver View File

@ -3,7 +3,7 @@
stats=$(<~/.cache/screensaver)
if [ "$stats" = "off" ]; then
echo "^c#a48ead^ ^d^"
echo "^c#a48ead^ ^d^"
else
echo "^c#a48ead^ ^d^"
echo "^c#a48ead^ ^d^"
fi

+ 4
- 8
suckless/dwm/keybind.h View File

@ -35,13 +35,11 @@ static const char *screenshot[] = { "scrot", "/tmp/%Y-%m-%d-%s_$wx$h.png", "-e",
static const char *windowshot[] = { "scrot", "-u", "/tmp/%Y-%m-%d-%s_$wx$h.png", "-e","xclip -selection clipboard -target image/png -i $f; cp $f ~/Pictures/Screenshots;notify-send \"SNAP\" \"$f\"", NULL };
static const char *simcrop[] = {"simcrop","-fc","-sc", "-g", "900x500",NULL};
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 *notification[] = {"/home/yigit/.scripts/dunst_toggle.sh", "-t",NULL};
static const char *screen_off[] = {"xset", "dpms", "force", "off", 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 *screensaver[] = {"/home/yigit/.scripts/screensaver_toggle", "-t",NULL};
static const char *online_class[] = {"/home/yigit/.scripts/tedportal",NULL};
@ -73,11 +71,9 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = tmuxcmd } },
{ 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|ShiftMask, XK_i, spawn, {.v = screensaver} },
{ MODKEY|ShiftMask, XK_o, spawn, {.v = screen_off } },
{ MODKEY, XK_n, spawn, {.v = notification_off} },
{ MODKEY|ShiftMask, XK_n, spawn, {.v = notification_on } },
{ MODKEY|ShiftMask, XK_n, spawn, {.v = notification } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },


Loading…
Cancel
Save