meta: Remove bspwm/sxhkd

I used bspwm for over half a decade, and although it was great, I am now
interested in using Hyprland, which is basically bspwm for Wayland but
better.
This commit is contained in:
Donovan Glover 2023-05-08 13:22:53 -04:00
parent d654c01f30
commit c15dc29944
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
11 changed files with 0 additions and 448 deletions

View File

@ -1,147 +0,0 @@
#!/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="librewolf"
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
# 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)
picom -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, necessary for Ventoy etc.
/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 -kk grave &
# Fix bar showing above fullscreen programs
~/.config/tint2/fullscreen.sh
# Disable middle click paste
xmousepasteblock &
# Make the start button work as expected
ksuperkey -t 200

View File

@ -1,10 +0,0 @@
#!/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"

View File

@ -1,18 +0,0 @@
# 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

View File

@ -1,30 +0,0 @@
#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2018 Donovan Glover
# TODO: Run this script when launching stuff, so we can use super+\ to launch anything + hide it again, and have terminal access
DROPDOWN_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
DROPDOWN_SCALE=$(($DROPDOWN_DPI / 96))
c='kitty' # Class
i='dropdown' # Instance
x='kitty --name' # Executable
# Note: This solution will not work with termite since it registers two ids.
# See https://github.com/thestinger/termite/issues/634 for more information.
id=$(xdo id -n $i)
rectangle=$((1700 * $DROPDOWN_SCALE))x$((600 * $DROPDOWN_SCALE))
offset=+$((110 * $DROPDOWN_SCALE))+$((100 * $DROPDOWN_SCALE))
# TODO: Use small window when holding shift
# TODO: Just use fullscreen from native bspwm/xorg instead of manually setting size
# rectangle=$((1920 * $DROPDOWN_SCALE))x$((1080 * $DROPDOWN_SCALE))
# offset=+$((0 * $DROPDOWN_SCALE))+$((0 * $DROPDOWN_SCALE))
bspc rule -r $c:$i
bspc rule -a $c:$i sticky=on state=floating rectangle=$rectangle$offset
([ -z "$id" ]) && ($x $i) ||
([[ $(xprop -id "$id" | awk '/window state: / {print $3}') == 'Withdrawn' ]] &&
xdo show -n $i || xdo hide -n $i)

View File

@ -1,28 +0,0 @@
#!/bin/sh
# Display brief desktop name notification at the center of the screen.
#
# Based on u/xircon's solution here:
# https://old.reddit.com/r/bspwm/comments/lhvtw7/osd_notifications_on_changing_desktop/
# Kill any old instances of dzen2 to prevent overlapping of notifications
pkill -x dzen2
# Display Variables:
hgt=128 # font size
wid=$((hgt*2)) # e.g. 3.5 times the height, will display the words 'Three' & 'Seven' correctly.
time=1
font="-*-Noto Sans CJK JP-bold-r-*-*-"$hgt"-*-*-*-*-*-*-*"
# Screen Resolution calculations:
full_res=$(cut -d " " -f 1 <<< $(xrandr | grep '*' | xargs)) # xargs removes leading spaces
res_wid="${full_res%%x*}" # Left of 'x' in 1600x900
res_hgt="${full_res##*x}" # Right of 'x'
# Do some calculations for x & y coordinates:
x=$((a=res_wid-wid, xx=a/2))
y=$((b=res_hgt-hgt-2, yy=b/2))
Deskname=$(bspc query -D -d focused --names)
# Display desktop number in the center of the screen:
echo "$Deskname" | dzen2 -bg "#000000" -w $wid -x $x -y $y -p $time -fn "$font"

View File

@ -1,23 +0,0 @@
#!/bin/sh
SOCK=$(fd kitty --base-directory /tmp -d 1)
KITTY=$(xdotool search --class kitty)
[ -e "/tmp/opacity-of-terminal" ] || echo 0.9 > /tmp/opacity-of-terminal
[ "$1" == "up" ] && \
NEXT=$(fish -N -c "math (cat /tmp/opacity-of-terminal) + 0.02") ||
NEXT=$(fish -N -c "math (cat /tmp/opacity-of-terminal) - 0.02")
[ "$1" == "up" ] && [ "$(cat /tmp/opacity-of-terminal)" == "1" ] && NEXT=1
[ "$1" == "down" ] && [ "$(cat /tmp/opacity-of-terminal)" == "0" ] && NEXT=0
echo "$NEXT" > /tmp/opacity-of-terminal
[ "$1" == "up" ] && \
notify-send -t 1000 "kitty" "Increased opacity to $NEXT" ||
notify-send -t 1000 "kitty" "Decreased opacity to $NEXT"
[ -n "$KITTY" ] && \
([ -e "/tmp/$SOCK" ] && \
(kitty @ --to "unix:/tmp/$SOCK" set-background-opacity "$NEXT"))

View File

@ -1,10 +0,0 @@
#!/bin/sh
SOCK=$(fd kitty --base-directory /tmp -d 1)
KITTY=$(xdotool search --class kitty)
[ -n "$KITTY" ] && \
([ -e "/tmp/$SOCK" ] && \
(kitty @ --to "unix:/tmp/$SOCK" launch --type=tab && \
bspc node $KITTY -f)) \
|| kitty --single-instance --start-as maximized

View File

@ -1,10 +0,0 @@
#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover
SCREENSHOT_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
SCREENSHOT_SCALE=$(($SCREENSHOT_DPI / 96))
DATETIME=`date +%F_%H%M%S`
shotgun ~/$DATETIME.png
notify-send -t 2000 "Screenshot saved as" "$DATETIME.png"

View File

@ -1,9 +0,0 @@
#!/bin/sh -e
DATETIME=`date +%F_%H%M%S`
if [[ "$1" == "clipboard" ]]; then
shotgun $(hacksaw -f "-i %i -g %g") - | xclip -t 'image/png' -selection clipboard
else
shotgun $(hacksaw -f "-i %i -g %g") ~/$DATETIME.png
fi

View File

@ -1,147 +0,0 @@
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover
# Reload sxhkd / Quit bspwm
super + {_, alt} + Escape
{pkill -USR1 -x sxhkd && notify-send -t 2000 "sxhkd" "Reloaded config",bspc quit}
super + d
libinput-gestures-setup restart && notify-send -t 2000 "libinput-gestures" "Reloaded config"
# Dynamically adjust gaps of current desktop
super + {_, shift +} g
{ bspc config -d focused window_gap $(( $(bspc config -d focused window_gap) + 10 )), \
[ $(bspc config -d focused window_gap) -ge 20 ] && \
bspc config -d focused window_gap $(( $(bspc config -d focused window_gap) - 10 )) }
# Dynamically adjust borders of nodes on current desktop
super + {_, shift +} i
{ bspc config -d focused border_width $(( $(bspc config -d focused border_width) + 1 )), \
[ $(bspc config -d focused border_width) -ge 1 ] && \
bspc config -d focused border_width $(( $(bspc config -d focused border_width) - 1 )) }
# Take a screenshot
super + p
~/.config/sxhkd/screenshot.sh
# Screenshot a selection
super + {shift,alt} + p
~/.config/sxhkd/selection.sh {_,clipboard}
# Open a new terminal window
super + {_,shift} + Return
~/.config/sxhkd/kitty.sh
# Toggle a dropdown terminal
super + backslash
~/.config/sxhkd/dropdown.sh
# TODO: Replace old polybar keybind with status notification
# toggle tint2: bottom_padding depends on the panel_size you set in tint2rc
super + o
(xdotool search --class --onlyvisible "tint2" && \
(xdo hide -n "tint2" && bspc config bottom_padding 0)) || \
(xdo show -n "tint2" && bspc config bottom_padding 30)
# Change the wal color scheme
super + m
wal -o ~/.config/wal/done.sh --theme random_dark -e
super + z
wal -o ~/.config/wal/done.sh -i ~/bgs -e
super + r
wal -o ~/.config/wal/done.sh -R -e
alt + F1
~/.config/rofi/launch.sh
super + {equal,minus}
~/.config/sxhkd/kitty-next.sh {up,down}
# ====================
# ======= Node =======
# ====================
# Close the focused window
super + {_,shift} + q
bspc node -{c,k}
# Switch to / Swap with the node in the specified direction
super + {_,shift} + {h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# FLAGS: Toggle between node flags
super + {x,y}
bspc node -g {sticky,private}
# FLAGS: Push and pop windows from the hidden stack
super + {_,shift} + b
bspc node {-g hidden,$(bspc query -N -n .hidden | tail -n 1) -g hidden=off}
# STATES: Toggle between node states
super + {t,w,f,space}
bspc node focused -t ~{tiled,pseudo_tiled,fullscreen,floating}
# PRESELECT: The direction to create a new node
super + ctrl + {h,j,k,l,space}
bspc node -p {west,south,north,east,cancel}
# RATIO: The size of a new node
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# =======================
# ======= Desktop =======
# =======================
# Focus a certain desktop / Send a node to a certain desktop
super + {_,shift} + {1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
# Easily go back and forth between the last desktop used
super + a
bspc desktop -f last
# Switch between tiled and monocle desktop layouts
super + c
bspc desktop -l next
# =======================
# ======= fn keys =======
# =======================
super + F1
pactl set-sink-mute @DEFAULT_SINK@ toggle && notify-send -t 2000 "Changed muted to" "$(pamixer --get-mute)"
super + F2
pamixer -d 5 && notify-send -t 2000 "Lowered volume to" "$(pamixer --get-volume)%"
super + F3
pamixer -i 5 && notify-send -t 2000 "Raised volume to" "$(pamixer --get-volume)%"
super + F4
pactl set-source-mute @DEFAULT_SOURCE@ toggle
super + F5
brightnessctl set 5%- && notify-send -t 2000 "Decreased brightness to" "$(brightnessctl get)"
super + F6
brightnessctl set +5% && notify-send -t 2000 "Increased brightness to" "$(brightnessctl get)"
super + F7
playerctl -p mpv previous && notify-send -t 2000 "Previous track" "$(playerctl -p mpv metadata xesam:title)"
super + F8
playerctl -p mpv next && notify-send -t 2000 "Next track" "$(playerctl -p mpv metadata xesam:title)"
super + F9
playerctl -p mpv play-pause && notify-send -t 2000 "mpv" "$(playerctl -p mpv status)"
super + F10
playerctl -p mpv position "5-" && notify-send -t 2000 "Minus 5 seconds" "$(playerctl -p mpv position)"
super + F11
playerctl -p mpv position "5+" && notify-send -t 2000 "Plus 5 seconds" "$(playerctl -p mpv position)"
# vim:ft=sxhkdrc

View File

@ -1,16 +0,0 @@
# sxhkd
[sxhkd][sxhkd] is a hotkey daemon for X11.
## Use Cases
sxhkd can be used to:
- Bind any key combination to whatever shell command you want
- Control windows in [bspwm](/bspwm) through `bspc`
You should not use sxhkd if:
- You use a desktop environment that sets keybinds for you
[sxhkd]: https://github.com/baskerville/sxhkd