Browse Source

Slock Stdout and Stderr

main
Yiğit Çolakoğlu 4 years ago
parent
commit
8cc7b3ac47
5 changed files with 23 additions and 8 deletions
  1. +1
    -1
      config/X11/xinitrc
  2. +5
    -2
      local/bin/pacontrol.sh
  3. +1
    -1
      suckless/dwm/keybind.h
  4. +4
    -2
      suckless/slock/config.h
  5. +12
    -2
      suckless/slock/slock.c

+ 1
- 1
config/X11/xinitrc View File

@ -43,7 +43,7 @@ fi
mpd & mpd &
mpd-mpris & mpd-mpris &
touch ~/.cache/nextcloud-track touch ~/.cache/nextcloud-track
xss-lock -- /home/yigit/.local/share/bin/lock &
xss-lock -- slock &
echo "on" > ~/.cache/screensaver echo "on" > ~/.cache/screensaver
dbus-update-activation-environment --systemd DISPLAY dbus-update-activation-environment --systemd DISPLAY
picom --no-fading-openclose & picom --no-fading-openclose &


+ 5
- 2
local/bin/pacontrol.sh View File

@ -20,12 +20,15 @@ case $1 in
"down") "down")
pactl set-sink-volume $latest_sink -$vol_interval% pactl set-sink-volume $latest_sink -$vol_interval%
;; ;;
"toggle-mute")
"toggle-mute")
pactl set-sink-mute $latest_sink toggle pactl set-sink-mute $latest_sink toggle
;; ;;
"open-mute")
"open-mute")
pactl set-sink-mute $latest_sink 1 pactl set-sink-mute $latest_sink 1
;; ;;
"close-mute")
pactl set-sink-mute $latest_sink 0
;;
*) usage ;; *) usage ;;
esac esac


+ 1
- 1
suckless/dwm/keybind.h View File

@ -23,7 +23,7 @@ static const char *mutevol[] = { "/home/yigit/.local/bin/pacontrol.sh", "toggl
static const char *upbright[] = {"/usr/bin/xbacklight","-inc","10",NULL}; static const char *upbright[] = {"/usr/bin/xbacklight","-inc","10",NULL};
static const char *downbright[] = {"/usr/bin/xbacklight","-dec","10",NULL}; static const char *downbright[] = {"/usr/bin/xbacklight","-dec","10",NULL};
static const char *lock[] = {"/home/yigit/.local/bin/lock",NULL};
static const char *lock[] = {"/usr/local/bin/slock",NULL};
static const char *clipmenu[] = {"/usr/bin/clipmenu","-i",NULL}; static const char *clipmenu[] = {"/usr/bin/clipmenu","-i",NULL};
static const char *play[] = {"/usr/bin/playerctl","play-pause",NULL}; static const char *play[] = {"/usr/bin/playerctl","play-pause",NULL};
static const char *prev[] = {"/usr/bin/playerctl","previous",NULL}; static const char *prev[] = {"/usr/bin/playerctl","previous",NULL};


+ 4
- 2
suckless/slock/config.h View File

@ -7,9 +7,11 @@ static const char *lights_on[] = { "/bin/curl", "http://yeetclock/setcolor?R=13
static const char *lights_off[] = { "/bin/curl", "http://yeetclock/setcolor?R=0&G=0&B=0&O=0", NULL }; static const char *lights_off[] = { "/bin/curl", "http://yeetclock/setcolor?R=0&G=0&B=0&O=0", NULL };
static const char *notifications_on[] = { "/home/yigit/.local/bin/dunst_toggle.sh", "-e", NULL }; static const char *notifications_on[] = { "/home/yigit/.local/bin/dunst_toggle.sh", "-e", NULL };
static const char *notifications_off[] = { "/home/yigit/.local/bin/dunst_toggle.sh", "-s", NULL }; static const char *notifications_off[] = { "/home/yigit/.local/bin/dunst_toggle.sh", "-s", NULL };
static const char *mute_on[] = { "/home/yigit/.local/bin/pacontrol.sh", "open-mute", NULL };
static const char *mute_off[] = { "/home/yigit/.local/bin/pacontrol.sh", "close-mute", NULL };
static const char **prelock[] = {lights_off, notifications_off};
static const char **postlock[] = {lights_on, notifications_on};
static const char **prelock[] = {lights_off, notifications_off, mute_on};
static const char **postlock[] = {lights_on, notifications_on, mute_off};
static const char *colorname[NUMCOLS] = { static const char *colorname[NUMCOLS] = {
[INIT] = "black", /* after initialization */ [INIT] = "black", /* after initialization */


+ 12
- 2
suckless/slock/slock.c View File

@ -415,15 +415,25 @@ usage(void)
void runprelock(){ void runprelock(){
for(int i = 0; i < LENGTH(prelock); i++){ for(int i = 0; i < LENGTH(prelock); i++){
if(fork() == 0)
if(fork() == 0){
int fd = open("/dev/null", O_WRONLY);
dup2(fd, 1);
dup2(fd, 2);
close(fd);
execvp(prelock[i][0], (char **)prelock[i]); execvp(prelock[i][0], (char **)prelock[i]);
}
} }
} }
void runpostlock(){ void runpostlock(){
for(int i = 0; i < LENGTH(prelock); i++){ for(int i = 0; i < LENGTH(prelock); i++){
if(fork() == 0)
if(fork() == 0){
int fd = open("/dev/null", O_WRONLY);
dup2(fd, 1);
dup2(fd, 2);
close(fd);
execvp(postlock[i][0], (char **)postlock[i]); execvp(postlock[i][0], (char **)postlock[i]);
}
} }
} }


Loading…
Cancel
Save