dotfiles/.config/bspwm/bspwmrc
Sarthak 0780a3abf5 readme at the root, and fix what would break on a fresh machine
The repo landing page showed .config, .themes and .gtkrc-2.0 and nothing else,
so there was no sign the bootstrap existed. It has always been at
.config/rice/install.sh - that is just where it lands on disk. Root README now
carries the curl one-liner, a map of what is tracked, and a note that this is a
bare repo over $HOME so nobody goes looking for a wrapper folder again.

Things that would not have survived a replication:

  - polybar's click and scroll handlers called $HOME/bin/system-info.sh and
    $HOME/bin/volume.sh. That directory does not exist; the scripts are in
    .config/scripts. The exec lines already pointed there, so only the
    interactive bits were dead.
  - bspwmrc hardcoded DisplayPort-0, so no desktops on any other machine.
    Takes the xrandr primary now, falling back to the first monitor bspc sees.
  - install.sh picked conflicting files out of git's checkout error with a
    regex that required a dot inside the name, so .bashrc and .xinitrc were
    never matched and never backed up - and .bashrc always exists on a fresh
    Arch install, which is precisely when the checkout aborts.
  - bspwmrc sourced ~/.env and merged ~/.Xresources unconditionally; neither
    exists. Guarded.

packages.txt was missing programs whose configs this repo already carries:
fish, neovim, yazi, kitty, plus xrdb/xsetroot/xsettingsd/wmname that bspwmrc
launches, gtk3 for the control panel, and wireplumber for the wpctl calls.

Newly tracked: .xinitrc (the thing that actually starts bspwm), .bashrc (which
holds the dotfiles alias), greenclip, flameshot, kitty, Thunar, mimeapps and
user-dirs. Dropped six editor backups that had been committed by accident.
Skipped QtProject.conf - it is file-dialog history, not configuration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011beBgzmH72WFn8wiWqRZPf
2026-09-04 10:09:16 +05:30

120 lines
4.4 KiB
Bash
Executable file

#! /bin/bash
# Qt apps follow qt6ct, which reads ~/.config/qt6ct/colors/dc.conf
export QT_QPA_PLATFORMTHEME=qt6ct
# GTK4 ignores gtk-application-prefer-dark-theme and did not pick up the
# portal's prefer-dark either, which left labels dark-on-dark. Forcing the
# dark variant here covers GTK3 and GTK4 both; ~/.config/gtk-{3,4}.0/gtk.css
# recolours it on top.
export GTK_THEME=Adwaita:dark
# Start sxhkd if it's not already running
pgrep -x sxhkd >/dev/null || sxhkd -c ~/.config/bspwm/sxhkdrc &
# Start picom
picom --config $HOME/.config/bspwm/picom.conf &
# Set window manager name to LG3D to fix some Java applications display issues
wmname LG3D
# Vars
export XDG_CURRENT_DESKTOP="bspwm"
[ -f "$HOME/.env" ] && . "$HOME/.env"
# Workspaces Configuration
# Whatever the primary output is called on this machine.
MONITOR="$(xrandr --query | awk '/ connected primary/{print $1; exit}')"
[ -z "$MONITOR" ] && MONITOR="$(bspc query -M --names | head -n1)"
bspc monitor "$MONITOR" -d 1 2 3 4 5 6 7 8
# Enable window focus follow mouse pointer
bspc config focus_follows_pointer true
# Auto set monitor
monitor=$(xrandr --query | grep " connected" | awk '{ print $1 }' | head -n 1)
resolution=$(xrandr --query | grep -A1 "^$monitor" | grep -Eo '[0-9]+x[0-9]+' | sort -V | tail -n 1)
refresh_rate=$(xrandr --query | grep -A1 "^$monitor" | grep -Eo '[0-9]+\.[0-9]+' | sort -V | tail -n 1)
if [[ -n $monitor && -n $resolution && -n $refresh_rate ]]; then
xrandr --output "$monitor" --mode "$resolution" --rate "$refresh_rate"
fi
# Set the border colors for focused and normal windows
bspc config focused_border_color "#92b9ea"
bspc config normal_border_color "#201b30"
bspc config active_border_color "#3d3752"
bspc config presel_feedback_color "#b483c0"
bspc config border_width 2
bspc config borderless_monocle true
# Set mouse cursor to left pointer
xsetroot -cursor_name left_ptr
# Configure gaps and window gap size
bspc config gapless_monocle false
bspc config window_gap 10
# Configure actions for moving and resizing floating windows with the mouse (mod4 = Super/Windows key)
bspc config pointer_modifier mod4
bspc config pointer_action1 move
bspc config pointer_action2 resize_side
bspc config pointer_action3 resize_corner
# Rules
bspc rule -a Control-panel.py state=floating layer=above center=on sticky=on border=off follow=on focus=on
bspc rule -a feh state=floating
bspc rule -a '*:sun-awt-X11-XWindowPeer' manage=off
bspc rule -a 'vlc' state=floating center=true
bspc rule -a 'Blueman-manager' state=floating center=true
bspc rule -a 'qt5ct' state=floating rectangle=900x600+0+0 center=true
bspc rule -a 'qt6ct' state=floating rectangle=900x600+0+0 center=true
bspc rule -a 'ark' state=floating center=true
bspc rule -a 'Xarchiver' state=floating center=true
bspc rule -a 'pavucontrol' state=floating center=true
bspc rule -a 'Yad' state=floating center=true
bspc rule -a 'Blueman-manager' state=floating center=true
bspc rule -a 'Gnome-calculator' state=floating rectangle=360x500+0+0 center=true
bspc rule -a 'loupe' state=floating rectangle=1200x800+0+0 center=true
bspc rule -a 'pavucontrol' state=floating rectangle=920x450+0+0 center=true
bspc rule -a 'gamescope' desktop=11
bspc rule -a 'legcord' desktop=10
# Resources and Utilities
# DISPLAY/XAUTHORITY must reach systemd-user + D-Bus or graphical portal backends
# (xdg-desktop-portal-gtk, used by browser file pickers) fail with "cannot open display".
systemctl --user import-environment DISPLAY XAUTHORITY XDG_CURRENT_DESKTOP
dbus-update-activation-environment --systemd DISPLAY XAUTHORITY XDG_CURRENT_DESKTOP
[ -f "$HOME/.Xresources" ] && xrdb merge "$HOME/.Xresources"
xsettingsd &
dunst &
flameshot &
sh $HOME/.config/polybar/launch.sh
sh $HOME/.config/scripts/polkitkdeauth.sh
sh $HOME/.config/scripts/set-wallpaper.sh
# Clipboard history daemon (super + v)
command -v greenclip >/dev/null 2>&1 && { pgrep -f 'greenclip daemon' >/dev/null || greenclip daemon & }
# Particle field on the wallpaper layer (run `particles` any time to toggle)
if command -v particles >/dev/null 2>&1; then
particles --start &
elif [ -x "$HOME/.local/bin/particles" ]; then
"$HOME/.local/bin/particles" --start &
fi
# Clipboard sync
if command -v clipnotify >/dev/null 2>&1 && command -v xclip >/dev/null 2>&1 && command -v cliphist >/dev/null 2>&1; then
(
while clipnotify; do
xclip -o -selection c | cliphist store
done
) &
fi
# Apps to open on startup
legcord &
xset s off &
xset s noblank &
xset dpms 0 0 0 &