diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 399c86a..02f7339 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -9,13 +9,15 @@ bspc config split_ratio 0.502 bspc config top_padding "$PANEL_HEIGHT" # Program startup -"$HOME"/.scripts/wm/pidctl.sh -p & +"$HOME"/.scripts/wm/wallpaper.sh & +"$HOME"/.scripts/wm/programs.sh & +"$HOME"/.scripts/panel/lemonbar.sh & # Colors bspc config focused_border_color "$FGCOLOR_INACTIVE" -bspc config normal_border_color "$BGCOLOR_INACTIVE" -bspc config active_border_color "$BGCOLOR_INACTIVE" -bspc config presel_feedback_color "$FGCOLOR_INACTIVE" +bspc config normal_border_color "$BGCOLOR_INACTIVE" +bspc config active_border_color "$BGCOLOR_INACTIVE" +bspc config presel_feedback_color "$FGCOLOR_INACTIVE" # Node bspc config borderless_monocle true @@ -31,7 +33,7 @@ bspc config pointer_modifier mod4 #--- Desktops ---# # Set desktops -$HOME/.scripts/wm/desktops.sh +"$HOME"/.scripts/wm/desktops.sh # Open program on specific desktop bspc rule -a firefox desktop="$WS1" diff --git a/.config/xorg/xinitrc b/.config/xorg/xinitrc index 3af139a..fc320d6 100644 --- a/.config/xorg/xinitrc +++ b/.config/xorg/xinitrc @@ -22,6 +22,15 @@ inputctl.sh -k on inputctl.sh -s off # Daemon starting -"$HOME"/.scripts/wm/pidctl.sh -d +dunst & +redshift & + +emacs --daemon & +thunar --daemon & + +sxhkd "$XDG_CONFIG_HOME/sxhkd/$WM" & +xss-lock -- "$HOME"/.scripts/wm/lock.sh & + +[ "$WM" = "bspwm" ] && stalonetray & exec $WM diff --git a/.scripts/wm/pidctl.sh b/.scripts/wm/pidctl.sh deleted file mode 100755 index 6d2d710..0000000 --- a/.scripts/wm/pidctl.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/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 diff --git a/.scripts/wm/programs.sh b/.scripts/wm/programs.sh new file mode 100755 index 0000000..3aa03ef --- /dev/null +++ b/.scripts/wm/programs.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +start() { + [ -z "$1" ] && return 1 + + [ -z "$(pidof -x "$(echo "$@" | cut -d ' ' -f 1)")" ] && $@ & +} + +start firefox +start urxvt + +# Thunar client doesnt get a new pid when running in daemon mode +[ "$(xdo id -a Thunar | wc -l)" -lt 3 ] && thunar &