diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-01-28 19:54:30 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-01-28 19:54:30 +0200 |
| commit | 0d73bba4a304f8e936038b8238a389c57dab1813 (patch) | |
| tree | b2ce36351f6c5816b2d5e1b3325959341223219b /.config/bspwm | |
| parent | 0426e29ea0c0480af6a54a0db2c339fbd26d03f0 (diff) | |
| download | dotfiles-0d73bba4a304f8e936038b8238a389c57dab1813.tar.gz dotfiles-0d73bba4a304f8e936038b8238a389c57dab1813.zip | |
Many changes including monitor setup/autostart apps etc and overall clean config
Diffstat (limited to '.config/bspwm')
| -rwxr-xr-x | .config/bspwm/bspwmrc | 301 |
1 files changed, 180 insertions, 121 deletions
diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index cacc5aa..241c65c 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -1,113 +1,148 @@ #! /bin/sh -#░█▀▄░█▀▀░█▀█░█░█░█▄█ -#░█▀▄░▀▀█░█▀▀░█▄█░█░█ -#░▀▀░░▀▀▀░▀░░░▀░▀░▀░▀ - -#bspc monitor -d 1 2 3 4 5 # 6 7 8 9 10 -#bspc monitor -d 1 2 3 4 5 6 7 8 9 10 -#bspc monitor LVDS-1 -d 1 2 3 4 5 -#bspc monitor HDMI-1 -d 6 7 8 9 0 -#bspc monitor LVDS-1 -d -#bspc monitor HDMI-1 -d -bspc monitor -d -#bspc monitor -d ① ② ③ ④ ⑤ -# - -###---Global Settings---### -#bspc rule -a '*' --one-shot state=below private=border_width:10 -bspc rule -a '*:Tiled' --one-shot state=tiled rectangle=50x50+0+50 -bspc rule -a '*' --one-shot state=floating rectangle=50x50+0+50 - -bspc config automatic_scheme alternate -bspc config initial_polarity second_child -bspc config pointer_modifier mod2 -bspc config pointer_action1 move -bspc config pointer_action2 resize_side -bspc config pointer_action3 resize_corner -bspc config focus_follows_pointer false -bspc config remove_disabled_monitors true -bspc config remove_unplugged_monitors true -bspc config merge_overlapping_monitors true -bspc config border_width 2 -bspc config window_gap 10 -bspc config split_ratio 0.52 -bspc config borderless_monocle true -bspc config gapless_monocle true -bspc config swallow_first_click false -bspc config pointer_modifier mod1 -#bspc config pointer_action1 resize_side -#bspc config pointer_action1 resize_corner -#bspc config pointer_action3 move -bspc config normal_border_color "#404040" -bspc config focused_border_color "#000000" -bspc config active_border_color "#000000" -bspc config presel_feedback_color "#BF616A" -#bspc config normal_border_color "#282828" -#bspc config active_border_color "#ebdbb2" -#bspc config focused_border_color "#fe8019" - -# remove all rules first -bspc rule -r *:* - -bspc rule -a Plank layer=above border=off - -###---Autostart---#### +################################################################################ +# ██████╗ ███████╗██████╗ ██╗ ██╗███╗ ███╗ # +# ██╔══██╗██╔════╝██╔══██╗██║ ██║████╗ ████║ # +# ██████╔╝███████╗██████╔╝██║ █╗ ██║██╔████╔██║ # +# ██╔══██╗╚════██║██╔═══╝ ██║███╗██║██║╚██╔╝██║ # +# ██████╔╝███████║██║ ╚███╔███╔╝██║ ╚═╝ ██║ # +# ╚═════╝ ╚══════╝╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝ # +################################## By: srdusr ################################## + +# ############################################################################## +# # ENV VARS # +# ############################################################################## + +## Environments +export PATH="${PATH}:${HOME}/.config/bspwm/bin" + +# Get the name of the primary monitor +mainmonitor=$(xrandr --query | awk '/ primary/{print $1}') + +## Monitors +# If no primary monitor is identified, use the first connected monitor +if [ "$mainmonitor" = "" ]; then + mainmonitor=$(xrandr --query | awk '/ connected/ {print $1; exit}') +fi + +# Set up workspaces on the primary monitor +bspc monitor "$mainmonitor" -d #1 2 3 4 5 + +# Check the number of connected monitors +connected_monitors=$(xrandr --query | grep -c " connected") + +if [ "$connected_monitors" -gt 1 ]; then + # Get the name of the secondary monitor (exclude the primary monitor) + secondmonitor=$(xrandr --query | awk '/ connected/ && $1 != "'"$mainmonitor"'" {print $1; exit}') + + # Set up workspaces on the secondary monitor + bspc monitor "$secondmonitor" -d #6 7 8 9 10 + # Check if the secondary monitor is connected and configure the layout + if [ "$secondmonitor" != "" ]; then + xrandr --output "$mainmonitor" --primary --auto --output "$secondmonitor" --auto --right-of "$mainmonitor" + fi +fi + +#INTERNAL_MONITOR="LVDS-1" +#EXTERNAL_MONITOR="HDMI-1" +## on first load setup default workspaces +#if [[ "$1" = 0 ]]; then +# if [[ $(xrandr -q | grep "${EXTERNAL_MONITOR} connected") ]]; then +# bspc monitor "$EXTERNAL_MONITOR" -d 1 2 3 4 5 +# bspc monitor "$INTERNAL_MONITOR" -d 6 7 8 9 10 +# bspc wm -O "$EXTERNAL_MONITOR" "$INTERNAL_MONITOR" +# else +# bspc monitor "$INTERNAL_MONITOR" -d 1 2 3 4 5 6 7 8 9 10 +# fi +#fi + +# ############################################################################## +# # FUNCTIONS # +# ############################################################################## + +config() { bspc config "$@" & } +rule() { bspc rule -a "$@" & } +run_once() { + if [ ! "$(pgrep -f "$1")" ]; then + "$@" & + fi +} + +# ############################################################################## +# # WINDOW RULES # +# ############################################################################## + +## Rules +bspc rule -r *:* # remove all rules first +rule '*' --one-shot state=below private=border_width:10 +rule '*:Tiled' --one-shot state=tiled rectangle=50x50+0+50 +rule '*' --one-shot state=floating rectangle=50x50+0+50 +#rule \* rectangle=680x700+340+40 +rule '*:*:Picture-in-Picture' state=floating sticky=on layer=above +rule '*:*:Picture in picture' state=floating sticky=on layer=above +rule firefox:Toolkit focus=on state=floating sticky=on layer=above rectangle=522x320+830+280 #320x190+1030+480 #522x316-10+280 +rule "https://www.youtube.com - Enhancer for YouTube™ — Mozilla Firefox" state=floating sticky=on layer=above +rule Wezterm state=floating +rule Zathura state=tiled +rule Pavucontrol state=floating rectangle=490x260+862+37 +rule Blueman-manager state=floating rectangle=536x420+818+37 #490x260-9+37 +rule scratchpad sticky=on state=floating # SCRATCHPAD +rule heads-up-display sticky=on state=floating rectangle=360x160+990+40 # Heads Up Display (scratchpad) +rule Onboard sticky=on state=floating rectangle=700x205+480-89 # Virtual keyboard +rule Plank layer=above border=off +rule firefox desktop='^1' +rule Spotify desktop='^5' + +# ############################################################################## +# # AUTOSTART APPS # +# ############################################################################## + +#"$HOME"/.scripts/bspwm_setup_monitors & pgrep -x sxhkd >/dev/null || sxhkd & picom -b --experimental-backends & -if [[ $(xrandr -q | grep 'HDMI-1 connected') ]]; then - xrandr --output LVDS-1 --primary --mode 1366x768 --rotate normal --output HDMI-1 --mode 1920x1080 --rotate normal --right-of LVDS-1 -fi #xfce4-panel --disable-wm-check & "$HOME"/.config/polybar/launch.sh & -#PANEL_HEIGHT=20 -#bspc config top_padding "$PANEL_HEIGHT" -#feh --bg-fill "$HOME"/pictures/wallpapers/national-park.jpg dunst & # notification daemon unclutter & # Remove mouse when idle nitrogen --force-setter=xinerama --restore & -#bspc rule -a \* rectangle=680x700+340+40 -bspc rule -a '*:*:Picture-in-Picture' state=floating sticky=on layer=above -bspc rule -a '*:*:Picture in picture' state=floating sticky=on layer=above -bspc rule -a firefox:Toolkit focus=on state=floating sticky=on layer=above rectangle=522x320+830+280 -#320x190+1030+480 -#522x316-10+280 -bspc rule -a "https://www.youtube.com - Enhancer for YouTube™ — Mozilla Firefox" state=floating sticky=on layer=above -bspc rule -a Wezterm state=floating -bspc rule -a Zathura state=tiled -bspc rule -a Pavucontrol state=floating rectangle=490x260+862+37 -bspc rule -a Blueman-manager state=floating rectangle=536x420+818+37 -#490x260-9+37 - -# SCRATCHPAD -bspc rule -a scratchpad sticky=on state=floating - -# Heads Up Display (scratchpad) -bspc rule -a heads-up-display sticky=on state=floating rectangle=360x160+990+40 - -# Virtual keyboard -bspc rule -a Onboard sticky=on state=floating rectangle=700x205+480-89 - -[ "$1" = 0 ] && { - nm-applet & - # #plank & -} +"$HOME"/.scripts/lockscreen-wallpaper & +xss-lock -- betterlockscreen -l & + +# Run polkit daemon if doesn't started. +#[ "$(pidof xfce-polkit)" != "" ] || /usr/lib/xfce-polkit/xfce-polkit & +/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & -#pkill xfce4-power-manager -#sleep 1 && nice -n 1 xfce4-power-manager & -#pkill volumeicon -#sleep 2 && nice -n 2 volumeicon & -#pkill mictray -#sleep 2 && nice -n 2 mictray & -#pkill parcellite -#sleep 2 && nice -n 2 parcellite & -#pkill blueman-manager -#sleep 2 && nice -n 2 blueman-manager & -#nohup onboard & /dev/null & -# Restart default apps - -declare -a restart=(xfce4-power-manager -plank flameshot onboard parcellite blueman-applet) +#rm "$HOME"/.cache/dunst.log +#rm -r "$HOME"/.cache/dunst/ +#rm "$HOME"/.cache/eww-control-center.lock +pkill eww +eww daemon +#eww open notification-popup +#"$HOME"/.local/bin/eww open bar & +#xdo lower -N eww-bar +#"$(which eww)" -c "$HOME"/.config/eww --restart open bar & +#pkill hotspots +#hotspots & +#pkill logs.sh +#logs.sh & + +# Volume and brightness indicator (xob) +# Activate virtual environment +source "$HOME"/.virtualenvs/bin/activate +run_once "$HOME"/.config/xob/launch.sh & +## Deactivate virtual environment +deactivate + +#wmname LG3D # Fixes Java applications +#export QT_QPA_PLATFORMTHEME="qt5ct" # Use qt5ct to set Qt theme +pkill low-bat-notifier +low-bat-notifier & +pkill plank.sh +plank.sh & +#run_once signal-desktop --start-in-tray & #--use-tray-icon +#run_once onboard --not-show-in=DESKTOPS & + +declare -a restart=(plank flameshot clipit redshift blueman-applet) for i in "${restart[@]}"; do pgrep -x "$i" | xargs kill sleep 0.5 @@ -121,27 +156,49 @@ if [[ ! $(pidof stalonetray) ]]; then touch "/tmp/syshide.lock" fi -xdotool search --sync --class Onboard windowunmap --sync %@ -#xdo hide -N Onboard - -# Eww -pkill eww -eww daemon -#pkill hotspots -#hotspots & -pkill logs.sh -logs.sh - -# Kill any existing instances of click_resize.py -pid=$(pgrep -f "python3 click_resize.py") -[ "$pid" != "" ] && kill "$pid" - -# Run click_resize.py in the background -nohup env/bin/python3 "$HOME"/.scripts/click_resize.py >/tmp/click_resize.log 2>&1 & - -#"$(which eww)" -c "$HOME"/.config/eww --restart open bar & -# Fullscreen +# ############################################################################## +# # CONFIGURATION # +# ############################################################################## + +## Config +PANEL_HEIGHT=30 +config top_padding "$PANEL_HEIGHT" +config honor_size_hints true +config automatic_scheme alternate +config initial_polarity second_child +config pointer_modifier mod1 +#config pointer_modifier mod2 +config pointer_action1 move +config pointer_action2 resize_side +config pointer_action3 resize_corner +config focus_follows_pointer false +config remove_disabled_monitors true +config remove_unplugged_monitors true +config merge_overlapping_monitors true +config border_width 2 +config window_gap 10 +config split_ratio 0.52 +config borderless_monocle true +config gapless_monocle true +config swallow_first_click false +#config pointer_action1 resize_side +#config pointer_action1 resize_corner +#config pointer_action3 move +config normal_border_color "#404040" +config focused_border_color "#000000" +config active_border_color "#000000" +config presel_feedback_color "#BF616A" +#config normal_border_color "#282828" +#config active_border_color "#ebdbb2" +#config focused_border_color "#fe8019" + + +# ############################################################################## +# # MISCELLANEOUS # +# ############################################################################## + +## Fullscreen bspc subscribe node_state | while read -r _ _ _ _ state flag; do if [[ "$state" != fullscreen ]]; then continue; fi if [[ "$flag" == on ]]; then @@ -153,6 +210,8 @@ bspc subscribe node_state | while read -r _ _ _ _ state flag; do fi done & +## Title-bar +pkill -9 title-bar && pkill -9 lemonbar # Check if title-bar is already running if ! pgrep -x "title-bar" >/dev/null; then # Create a lock file @@ -177,4 +236,4 @@ if ! pgrep -x "title-bar" >/dev/null; then fi fi -#bspc config external_rules_command ~/.config/bspwm/scripts/external_rules.sh +#config external_rules_command ~/.config/bspwm/scripts/external_rules.sh |
