Add daemon and program starter script
This commit is contained in:
+1
-6
@@ -13,12 +13,7 @@ set $mod2 Mod1
|
|||||||
floating_modifier $mod
|
floating_modifier $mod
|
||||||
|
|
||||||
# Application startup
|
# Application startup
|
||||||
exec_always --no-startup-id $HOME/.scripts/wm/wallpaper.sh &
|
exec_always --no-startup-id $HOME/.scripts/wm/pidctl.sh -p
|
||||||
exec --no-startup-id $HOME/.scripts/panel/lemonbar.sh &
|
|
||||||
exec --no-startup-id firefox
|
|
||||||
exec --no-startup-id urxvt
|
|
||||||
exec --no-startup-id thunar
|
|
||||||
exec --no-startup-id xss-lock -- $HOME/.scripts/wm/lock.sh &
|
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
set_from_resource $bgcolor WmColor.bgcolor #000000
|
set_from_resource $bgcolor WmColor.bgcolor #000000
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ super + {_,shift} + m
|
|||||||
|
|
||||||
#--- Control ---#
|
#--- Control ---#
|
||||||
|
|
||||||
# Reload sxhkd config and panel
|
# Reload sxhkd config
|
||||||
super + ctrl + r
|
super + ctrl + r
|
||||||
pkill -USR1 -x sxhkd; $HOME/.scripts/panel/lemonbar.sh &
|
pkill -USR1 -x sxhkd
|
||||||
|
|
||||||
# Lock
|
# Lock
|
||||||
super + alt + l
|
super + alt + s
|
||||||
$HOME/.scripts/wm/lock.sh
|
$HOME/.scripts/wm/lock.sh
|
||||||
|
|
||||||
# Shutdown
|
# Shutdown
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ inputctl.sh -k on
|
|||||||
inputctl.sh -s off
|
inputctl.sh -s off
|
||||||
|
|
||||||
# Daemon starting
|
# Daemon starting
|
||||||
dunst &
|
"$HOME"/.scripts/wm/pidctl.sh -d
|
||||||
redshift &
|
|
||||||
|
|
||||||
thunar --daemon &
|
|
||||||
|
|
||||||
sxhkd "$XDG_CONFIG_HOME/sxhkd/$WM" &
|
|
||||||
|
|
||||||
exec $WM
|
exec $WM
|
||||||
|
|||||||
Executable
+93
@@ -0,0 +1,93 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
help() {
|
||||||
|
B=$(tput bold)
|
||||||
|
U=$(tput smul)
|
||||||
|
N=$(tput sgr0)
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
${B}NAME${N}
|
||||||
|
pidctl.sh - Daemon and program starter
|
||||||
|
|
||||||
|
${B}SYNOPSIS${N}
|
||||||
|
${B}pidctl.sh${N} [${U}OPTION${N}]
|
||||||
|
|
||||||
|
${B}OPTIONS${N}
|
||||||
|
${B}-d${N}
|
||||||
|
Start daemons, run this from xinitrc.
|
||||||
|
|
||||||
|
${B}-p${N}
|
||||||
|
Program startup, run this from WM config.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
[ -z "$1" ] && return 1
|
||||||
|
|
||||||
|
IS_RUNNING=$(pidof -x "$(echo "$@" | cut -d ' ' -f 1)")
|
||||||
|
[ -z "$IS_RUNNING" ] && $@ &
|
||||||
|
}
|
||||||
|
|
||||||
|
daemon() {
|
||||||
|
start dunst
|
||||||
|
start redshift
|
||||||
|
|
||||||
|
start emacs --daemon
|
||||||
|
start thunar --daemon
|
||||||
|
|
||||||
|
start sxhkd "$XDG_CONFIG_HOME/sxhkd/$WM"
|
||||||
|
start xss-lock -- "$HOME"/.scripts/wm/lock.sh
|
||||||
|
|
||||||
|
[ "$WM" = "bspwm" ] && start stalonetray
|
||||||
|
}
|
||||||
|
|
||||||
|
program() {
|
||||||
|
# Application startup always
|
||||||
|
|
||||||
|
"$HOME"/.scripts/wm/wallpaper.sh &
|
||||||
|
"$HOME"/.scripts/panel/lemonbar.sh &
|
||||||
|
|
||||||
|
# Application startup once
|
||||||
|
|
||||||
|
# Firefox
|
||||||
|
start firefox
|
||||||
|
|
||||||
|
# Thunar
|
||||||
|
[ "$(xdo id -a Thunar | wc -l)" -lt 4 ] && thunar &
|
||||||
|
|
||||||
|
# URxvt
|
||||||
|
if [ "$WM" = "bspwm" ]; then
|
||||||
|
# Start urxvt on desktop 3
|
||||||
|
$(bspc rule -a URxvt desktop="^$WS3" \
|
||||||
|
&& start urxvt \
|
||||||
|
&& sleep 3 \
|
||||||
|
&& bspc rule -r URxvt desktop) &
|
||||||
|
|
||||||
|
elif [ "$WM" = "i3" ]; then
|
||||||
|
start urxvt
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# If no option is provided
|
||||||
|
[ "$#" -eq 0 ] && help && exit
|
||||||
|
|
||||||
|
SCRIPT="$(basename "$0")"
|
||||||
|
# Option handling
|
||||||
|
while getopts 'hdp' opt; do
|
||||||
|
case $opt in
|
||||||
|
h)
|
||||||
|
help
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
daemon
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
program
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Try '$SCRIPT -h' for more information."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user