summaryrefslogtreecommitdiff
path: root/dot-config/bspwm/bspwmrc
blob: 4f5a44d24504521ccaa68b9d4153e2d0e5ace68f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
#!/usr/bin/env bash

## BSPWM config file for Arch

## General ---------------------------------------------------#

## Bspwm config directory
BSPDIR="$HOME/.config/bspwm"
ROFIDIR="$HOME/.config/rofi"
POLYBARDIR="$HOME/.config/polybar"
SCRIPTSDIR="$HOME/scripts"

## Export bspwm/bin dir to PATH
export PATH="${PATH}:$BSPDIR/scripts:$ROFIDIR/scripts:$POLYBARDIR/scripts:$SCRIPTSDIR"

## Run java applications without issues
export _JAVA_AWT_WM_NONREPARENTING=1
#wmname LG3D
## Current theme ---------------------------------------------#

## Bspwm colors
BSPWM_FBC='#81A1C1'
BSPWM_NBC='#2E3440'
BSPWM_ABC='#B48EAD'
BSPWM_PFC='#A3BE8C'

## Bspwm appearance
BSPWM_BORDER='4'
BSPWM_GAP='10'
BSPWM_SRATIO='0.50'

## Configurations --------------------------------------------#

## Manager Workspaces
workspaces() {
	name=1
	for monitor in `bspc query -M`; do
		#bspc monitor ${monitor} -n "$name" -d '1' '2' '3' '4' '5' '6' '7' '8' '9' '10'
		#bspc monitor ${monitor} -n "$name" -d 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J'
		#bspc monitor ${monitor} -n "$name" -d 'I' 'II' 'III' 'IV' 'V' 'VI' 'VII' 'VIII' 'IIX' 'X'
		bspc monitor ${monitor} -n "$name" -d '' '' '' '' '' '' '' '' '' '  '
        let name++
	done
}
workspaces

## Apply bspwm configurations
bspc config border_width "$BSPWM_BORDER"
bspc config window_gap "$BSPWM_GAP"
bspc config split_ratio "$BSPWM_SRATIO"

bspc config focused_border_color "$BSPWM_FBC"
bspc config normal_border_color "$BSPWM_NBC"
bspc config active_border_color "$BSPWM_ABC"
bspc config presel_feedback_color "$BSPWM_PFC"

bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config paddingless_monocle true
bspc config single_monocle false
bspc config focus_follows_pointer true
bspc config presel_feedback true

# bspc config ignore_ewmh_focus true
bspc rule -a '*:*:Picture in picture' state=floating sticky=on focus=off

## Manage all the unmanaged windows remaining from a previous session.
bspc wm --adopt-orphans

## Window rules ----------------------------------------------#

# reset rules
bspc rule -r *:*

# already have a top_padding(does the same) to avoid polybar overlap window
bspc rule -a polybar private

## 1 > terminal (always open terminal on workspace-1)
bspc rule -a Alacritty desktop='^1' follow=on focus=on
bspc rule -a Xfce4-terminal desktop='^1' follow=on focus=on

## 2 > web (always open web browser on workspace-2)
declare -a web=(Thorium-browser Brave-browser chromium firefox)
for i in ${web[@]}; do
   bspc rule -a $i desktop='^2' follow=on focus=on; done

## 3 > files (always open file manager on workspace-3)
declare -a files=(Pcmanfm Thunar qBittorrent Caja)
for i in ${files[@]}; do
   bspc rule -a $i desktop='^3' follow=on focus=on; done

## 4 > code (always open editors on workspace-4)
declare -a code=(Geany code-oss 'code - oss' 'Code - OSS' code Code install4j-burp-StartBurp burp-StartBurp unityhub Unity jetbrains-pycharm-ce)
for i in ${code[@]}; do
   bspc rule -a $i desktop='^4' follow=on focus=on; done

## 5 > office and docs (always open office/doc apps on workspace-5)
declare -a office=(Gucharmap Atril Evince libreoffice-writer libreoffice-calc libreoffice-impress libreoffice-startcenter libreoffice Soffice *:libreofficedev *:soffice Typora obsidian figma-linux anytype craft-nativefier-e0958b)
for i in ${office[@]}; do
   bspc rule -a $i desktop='^5' follow=on focus=on; done

## 6 > communication (always open communication apps on workspace-6)
declare -a comm=(Thunderbird TelegramDesktop Hexchat discord vesktop beeper Beeper VencordDesktop Chat-gpt Whatsapp-for-linux Chatbox)
for i in ${comm[@]}; do
   bspc rule -a $i desktop='^6' follow=on focus=on; done

## 7 > media/video (always open media/video apps on workspace-7)
declare -a media=(Audacity Music MPlayer Lxmusic Inkscape Gimp Blender blender obs zoom Zoom Pitivi kdenlive openshot vlc Spotify "Spotify Premium" cider Cider shotwell Shotwell)
for i in ${media[@]}; do
   bspc rule -a $i desktop='^7' state=tiled follow=on focus=on; done # floating

## 8 > games (always open games on workspace-8)
declare -a game=(Minecraft *:Minecraft badlion Badlion Launcher launcher War war "War Thunder (Vulkan, 64bit)" Steam steam_proton csgo_linux64 minecraft-launcher:"Minecraft Launcher" Blueman-manager "Minecraft Launcher" lunarclient *:"Lunar Client" retroarch "Minecraft Launcher" "An Anime Game Launcher" "Lutris" "genshinimpact.exe")
for i in ${game[@]}; do
    bspc rule -a $i desktop='^8' state=floating follow=off focus=off; done

## 9 > system (always open system apps on workspace-9)
bspc rule -a 'Virt-manager' desktop='^9' follow=on focus=on
bspc rule -a 'blueman-adapters' desktop='^9' follow=on focus=on
bspc rule -a GParted desktop='^9' follow=on focus=on
bspc rule -a 'Xdm-app'='^9' follow=on focus=on
bspc rule -a timeshift-gtk='^9' follow=on focus=on
bspc rule -a Timeshift-gtk='^9' follow=on focus=on
bspc rule -a nextcloud='^9' follow=on focus=on
bspc rule -a Nextcloud='^9' follow=on focus=on
bspc rule -a gearlever='^9' follow=on focus=on
bspc rule -a com.github.tchx84.Flatseal='^9' follow=on focus=on
declare -a settings=(Lxappearance Lxtask Lxrandr Arandr System-config-printer.py Pavucontrol Exo-helper-1 Protonvpn Xfce4-power-manager-settings Mysql-workbench-bin Grub-customizer Nitrogen archlinux-tweak-tool.py Archlinux-tweak-tool.py pamac-manager helvum Vmware "Btrfs Assistant" Bitwarden wootility-lekker)
for i in ${settings[@]}; do
   bspc rule -a $i desktop='^9' state=floating follow=on focus=on; done

## misc/ghost/random/placeholder (always open those apps/placeholders on workspace-10)
declare -a misc=(maxautoclicker Maxautoclicker os_server Os_server)
for i in ${misc[@]}; do
    bspc rule -a $i desktop='^10' state=floating follow=off focus=false; done

## Always Floating Apps
declare -a floating=(alacritty-float Pcmanfm Onboard Yad zoom Xdm-app exe wechat WeChat sxiv Sxiv 'Firefox:Places' Viewnior feh Nm-connection-editor install4j-burp-StartBurp Thorium-browser:app.shortwave.com Thorium-browser:crx_lnachpgegbbmnnlgpokibfjlmppeciah) # Thorium-browser:crx_mdpkiolbdkhdjpekfbkbmhigcaggjagi
for i in ${floating[@]}; do
   bspc rule -a $i state=floating follow=on focus=on; done

## Always sticky apps
declare -a sticky=(Thorium-browser:app.shortwave.com Thorium-browser:crx_lnachpgegbbmnnlgpokibfjlmppeciah) # Thorium-browser:crx_mdpkiolbdkhdjpekfbkbmhigcaggjagi
for i in ${sticky[@]}; do
   bspc rule -a $i sticky=on; done

## special rules
# bspc rule -a Thorium-browser:crx_mdpkiolbdkhdjpekfbkbmhigcaggjagi desktop='' follow=on focus=on
# bspc rule -a Thorium-browser:crx_lnachpgegbbmnnlgpokibfjlmppeciah desktop='' follow=on focus=on


bspc rule -a Conky state=floating manage=off
bspc rule -a stalonetray state=floating manage=off
#bspc config pointer_action1 none

## Autostart -------------------------------------------------#

# Kill if already running
killall -9 xsettingsd sxhkd dunst ksuperkey xfce4-power-manager bspc runtransani.sh cleanfullscreen audio-autoAdjust.sh #rrunbgblur.sh  # launching with conditions .feh backgroundblur chat-server mpd-mpris xbindkeys landdrop
killall -15 idle.sh # reflector.sh
#eww kill

# Start bspwm scripts
$HOME/scripts/polybar-temp-autofix.sh &
bspbar &
#bspcomp &
# for better animation(make higher pri(nice))
# need /etc/sudoers to `Defaults env_keep += "HOME"` be setted
sudo nice -n -20 sudo -u $USER bspcomp & # nah, i don t think it affects it lmao
# bspcomp &
bspdunst &
bspfloat &

# Lauch xsettingsd daemon
xsettingsd --config=$HOME/.config/xsettingsd &
# xbindkeys & # no longer used, using sxhkdrc

# auth daemon(gnome)
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

# kdeconnect
/usr/bin/kdeconnectd &

# Launcher xdm daemon
#xdman -d &

# polkit agent
#if [[ ! `pidof xfce-polkit` ]]; then
	#/usr/lib/xfce-polkit/xfce-polkit &
#fi

# Lauch keybindings daemon
sxhkd -c "$BSPDIR"/sxhkdrc &

# Enable Super Keys For Menu
ksuperkey -e 'Super_L=Alt_L|F1' &
ksuperkey -e 'Super_R=Alt_L|F1' &

xrdb -merge ~/.Xresources

# Enable power management
/usr/bin/xfce4-power-manager &

# Fix cursor
# xsetroot -cursor_name left_ptr

# Restore wallpaper
#exec $HOME/.feh &
# ========= #
# if i don't use .feh first, there will be a few second it's blanked out so I have to do a feh background first and then the wallblur one.
# ========= #
# better wallpaper manager wallblur
exec $HOME/scripts/wallpapertrans.sh & # https://github.com/nemanjan00/i3wm/raw/master/wallpaper.sh can replace after picom support blur(transition animation(blur))

# Start mpd
# exec mpd &
# exec mpd-mpris &

# start fcitx
exec fcitx -d &

# enable numlock
numlockx &
#sudo numlock
#for tty in /dev/tty{1..6}; do
#    /usr/bin/setleds -D +num < "$tty";
#done
# configured in as a service unit

# start clipboard daemon
exec clipmenud &

# youtube-dl extention daemon
#exec youtube-dl-server --number-processes 1 & # dont really use it now so ya

# swallow
#pgrep bspswallow || bspswallow & # tODO: FIX THE THING

# clean full screen
/usr/bin/ps ax | grep -v grep | grep cleanfullscreen > /dev/null || cleanfullscreen &

# bitwarden
/usr/bin/ps ax | grep -v grep | grep bitwarden > /dev/null || bitwarden-desktop &

# autolock
#xautolock -time 30 -locker "betterlockscreen -l" & # don't really need/want that

# so animation is not cached(idk why restarting picom make it not laggy)
#xautolock -time 1 -locker "exec $HOME/scripts/resbspcomp.sh" &

# kill not needed
#killall java

# idle stuff
$HOME/scripts/idle.sh -d &

# audio auto adjust
$HOME/scripts/audio-autoAdjust.sh -d &

# 1. autoupdate
#exec $HOME/scripts/auto-update.sh & # replaced with systemd units # moved into idle.sh

#update &
yay -Sl > /tmp/yaySl &
yay -Ss > /tmp/yaySs &


# startup sound
#$HOME/scripts/startupsound.sh & # exist in user systemd unit

# apparmor(aa) noitfication for denials
/usr/bin/ps ax | grep -v grep | grep aa-notify > /dev/null || aa-notify -p -s 1 -w 60 -f /var/log/audit/audit.log &

# wifi share
# script -c "sudo -E openwifipass -s Jhome-Guest -k 12345677Jj" $HOME/scripts/logs/openwifipass.log &
# exec $HOME/scripts/runsharewifi.sh &


# autoclicker
# now in $HOME/scripts/bin/autoclicker
#/usr/bin/ps ax | grep -v grep | grep maxautoclicker > /dev/null || kdocker maxautoclicker &

# polybar no overlap
bspc config top_padding 80

# secret chat-server
#$HOME/scripts/bin/chat-server &

# just incase auto start application move to other desktops
# prevent restarting bspwm from doing that
#bspc desktop -f ^1


# remove startup lock
if [ -f /var/lock/startup.lock ]; then
    # autostart script
    exec $HOME/scripts/autostart &
    # startup sound
    $HOME/scripts/startupsound.sh &
    # auto startup apps
    $HOME/scripts/startapp &
    spid=$!
    # go back first desktop(last)
    wait $spid
    bspc desktop -f "^1"
    # clean-up (last)
    sudo /sbin/rm -f /var/lock/startup.lock
fi

# sys tray wait(timeout)
# sleep 10
# connection with other computers(universal control)
while ! systemctl is-active network.target; do
  wait
done
/usr/bin/ps ax | grep -v grep | grep input-leap || input-leap &

# nextcloud
/usr/bin/ps ax | grep -v grep | grep nextcloud > /dev/null || nextcloud --background &

# vencord
/usr/bin/ps ax | grep -v grep | grep discord > /dev/null || discord --start-minimized &

# beeper
/usr/bin/ps ax | grep -v grep | grep beeper > /dev/null || beeper --hidden&
# /usr/bin/ps ax | grep -v grep | grep blueman-applet || blueman-applet &
# /usr/bin/ps ax | grep -v grep | grep nm-applet || nm-applet &
# /usr/bin/ps ax | grep -v grep | grep memento-bg || memento-bg <<< 1 &