Revert "meta: Remove bspwm"

2 months ago, I removed bspwm in favor of GNOME. After using GNOME as a
daily driver for some months now, I can appreciate it as a nice desktop
environment for many GNU/Linux users, however it does not meet my needs
as well as a customized window manager setup can.

In reality, I don't need *too much* from a window manager; it just needs
to manage windows in a reasonable way. For anything else I need, I am
free to program it myself as a learning exercise. I prefer understanding
most if not everything running in my environment versus having various
GNOME utilities running in the background.
This commit is contained in:
Donovan Glover 2023-03-19 16:09:04 -04:00
parent 5916e69acf
commit 15f6d80a52
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 193 additions and 0 deletions

165
bspwm/.config/bspwm/bspwmrc Executable file
View File

@ -0,0 +1,165 @@
#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2018-2022 Donovan Glover
export SXHKD_SHELL="/usr/bin/bash"
export XCURSOR_THEME="phinger-cursors"
export XDG_DATA_DIRS="/usr/share:/usr/share:/usr/local/share"
export BROWSER="qutebrowser"
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export GLFW_IM_MODULE=ibus
export XSECURELOCK_SAVER=saver_mpv
export XSECURELOCK_COMPOSITE_OBSCURER=0
sxhkd &
# Use Left/Up/Right/Down for primary monitor
bspc monitor -d 一 二 三 四 五 六 七 八 九 十
bspc config split_ratio 0.50
# Make moving windows look nice at 240Hz
bspc config pointer_motion_interval 4
# Don't use borders/gaps by default
bspc config border_width 0
bspc config window_gap 0
bspc config single_monocle true
# Always focus the window under the cursor
# while moving the mouse, similar to i3
bspc config focus_follows_pointer true
# Change the default X shaped cursor to a pointer
xsetroot -cursor_name left_ptr
# Set a temporary black background to avoid flash
~/.config/feh/tile.sh 000000
# If running with VirtualBox client utilities, start them.
# Useful for automatically changing display resolution, etc.
if hash VBoxClient-all 2>/dev/null; then
VBoxClient-all
fi
# Use the previous color scheme if present. Otherwise use a sane default.
if [ -e ~/.cache/wal/colors.json ]; then
wal -o ~/.config/wal/done.sh -R
else
wal -o ~/.config/wal/done.sh --theme base16-tomorrow-night
fi
# Never blank the screen if it's a virtual machine (disable power saving)
VIRTUAL="$(systemd-detect-virt)"
if [[ "$VIRTUAL" != "none" ]]; then
xset s off -dpms
fi
# Start picom (prevents screen tearing)
# Note: --experimental-backends adds support for dual kawase blur
picom --experimental-backends -b
# Start bar
tint2 &
# Change cursor size and other things based on DPI
# Get the host width
HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width')
CURSOR_THEME=${XCURSOR_THEME:-phinger-cursors}
# If the DPI is not set, set it to 96 by default
if [ -z "$(xrdb -query | grep dpi)" ]; then
X_DPI=96
fi
# Determine the DPI based on screen width
if [ "$HOST_WIDTH" -eq "1920" ]; then
X_DPI=96
fi
if [ "$HOST_WIDTH" -eq "3840" ]; then
X_DPI=192
fi
# Reposition the desktop background
~/.fehbg &
# If the DPI needs to be changed, change it
if [ "$X_DPI" ]; then
echo "Xft.dpi:$X_DPI" | xrdb -merge
# Change the X cursor size as well
# NOTE: For full effect, this needs to be used in combination with XCURSOR_SIZE.
# NOTE: ($X_DPI / 6) here means that 4k will use cursor size 32, so it will appear
# about half the size of the 1080p cursor. If this is not what you want, use
# cursor size 64 instead.
xsetroot -xcf "/usr/share/icons/$CURSOR_THEME/cursors/left_ptr" "$(($X_DPI / 6))"
fi
# bspc rules
bspc rule -a feh state=floating
bspc rule -a kitty:floating state=floating
bspc rule -a Rofi state=floating
# Configure touchpad
xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Natural Scrolling Enabled" 1
xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1
xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Disable While Typing Enabled" 0
# Auto-hide the mouse cursor when inactive
unclutter &
# Start the notification daemon
dunst &
# Use a cool crossfade effect
# mpc crossfade 3
# Start fcitx
fcitx5 &
# Auto-mount partitions
udiskie &
# Start mullvad notifications
if hash mullvad-vpn 2>/dev/null; then
mullvad-vpn &
fi
# Start an authentication agent for polkit
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
# Use maximum brightness on the keyboard by default
brightnessctl --device='tpacpi::kbd_backlight' set 2
# Enable alt tab
alttab -d 1 -w 1 -font "xft:Noto Sans CJK JP" -mk Super_L &
# Fix bar showing above fullscreen programs
xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" $(xdo id -n tint2)
# Open new nodes on the next unoccupied desktop (dynamic desktops part 1)
bspc subscribe node_add | while read event; do
if [ $(bspc query -N -n '.local.!hidden.tiled' | wc -l) -gt 1 ]; then
nodeId=$(echo "$event" | cut -d" " -f 5)
next=$(bspc query -D -d 'next.!occupied')
if [ -n "$next" ]; then
bspc node "$nodeId" --to-desktop "$next" --follow
fi
fi
done &
# Go to the previous node if the current desktop is empty (dynamic desktops part 2)
bspc subscribe node_remove | while read event; do
if [ -n "$(bspc query -D -d '.!occupied' | rg $(bspc query -D -d focused))" ]; then
bspc query -N -n older && bspc node older -f || bspc desktop '^1' -f
fi
done &
# Make the start button work as expected
ksuperkey -t 200

10
bspwm/.config/bspwm/wal.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Source the colors from wal
source ~/.cache/wal/colors.sh
# Set the border colors
bspc config normal_border_color "$color8"
bspc config active_border_color "$color2"
bspc config focused_border_color "$color7"
bspc config presel_feedback_color "$color7"

18
bspwm/README.md Normal file
View File

@ -0,0 +1,18 @@
# bspwm
[bspwm][bspwm] is a tiling window manager for X11.
## Use Cases
bspwm can be used to:
- Automatically tile all kinds of windows, maximizing screen estate
- Have complete control of your window manager through simple shell commands
- Minimize resource usage; bspwm works best without a desktop environment
You should not use bspwm if:
- You are using a desktop environment
- You just want to open multiple shells (use [kitty](/kitty) or [tmux](/tmux) for this instead)
[bspwm]: https://github.com/baskerville/bspwm