Skip to content

Instantly share code, notes, and snippets.

@huj13k4n9
Last active January 16, 2023 12:00
Show Gist options
  • Save huj13k4n9/6f1b12c2abf436be46719772f27cd189 to your computer and use it in GitHub Desktop.
Save huj13k4n9/6f1b12c2abf436be46719772f27cd189 to your computer and use it in GitHub Desktop.
bspwm-config
#!/bin/sh
/usr/bin/loginctl lock-session
#!/usr/bin/env bash
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
masked=$(bspc query -N -n .hidden -d focused)
if [ -z "$masked" ]; then
bspc node focused -g hidden=on
else
bspc node "$masked" -g hidden=off
fi
#! /bin/sh
## Run java applications without issues
export _JAVA_AWT_WM_NONREPARENTING=1
## Bspwm colors
BSPWM_FBC='#81A1C1'
BSPWM_NBC='#2E3440'
BSPWM_ABC='#B48EAD'
BSPWM_PFC='#A3BE8C'
## Bspwm appearance
BSPWM_BORDER='2'
BSPWM_GAP='0'
BSPWM_SRATIO='0.50'
## 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'
#bspc monitor ${monitor} -n "$name" -d 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H'
#bspc monitor ${monitor} -n "$name" -d 'I' 'II' 'III' 'IV' 'V' 'VI' 'VII' 'VIII'
# 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 bottom_padding 68
# remove all rules first
bspc rule -r *:*
# custom rules
bspc rule -a 'yesplaymusic' state=floating center=on focus=on
bspc rule -a 'QQ' state=floating follow=on center=on focus=on
bspc rule -a 'systemsettings' state=floating center=on focus=on
bspc rule -a 'plasmashell' state=floating center=on focus=on
bspc rule -a 'dolphin' state=floating center=on focus=on
# start sxhkd
sxhkd &
##---------- Keybindings for bspwm ----------##
# Terminal
super + Return
konsole
super + alt + Return
konsole --fullscreen
##---------- Applications ----------##
# Launch Apps
super + shift + {f,w,e,m}
{dolphin,microsoft-edge-stable,code,/opt/YesPlayMusic/yesplaymusic}
# Color Picker
super + p
systemsettings5 kcm_kscreen
# Lockscreen
super + alt + l
~/.config/bspwm/bsplockscreen
##---------- System Keys ----------##
# Take a screenshot
super + shift + s
deepin-screenshot
Print
deepin-screenshot
super + Print
deepin-screenshot --fullscreen --save-path ~/Pictures/screenshot
# Brighness control
XF86MonBrightness{Up,Down}
xbacklight { --inc, --dec} 5
# Speaker Volume control
XF86Audio{RaiseVolume,LowerVolume}
amixer -q set Master {5%+, 5%-} unmute
# Mic Volume control
XF86Audio{Mute,MicMute}
amixer -D pulse sset Master toggle-mute
# Music control
XF86Audio{Next,Prev,Play,Stop}
mpc {next,prev,toggle,stop}
##---------- Bspwm ----------##
# Hide/Unhide Window
super + shift + h
~/.config/bspwm/bspwinmask
# Close App
super + {_,shift + }c
bspc node -{c,k}
# kill window
ctrl + alt + Escape
xkill
# Quit/Restart bspwm
ctrl + shift + {q,r}
bspc {quit,wm -r}
# Reload Keybindings
super + Escape
pkill -USR1 -x sxhkd
# Switch workspace
ctrl + alt + {Left,Right}
bspc desktop -f {prev.local,next.local}
# Switch workspace or Send focused Node to another workspace
super + {1-8}
bspc desktop -f '^{1-8}' '--follow'
super + shift + {1-8}
bspc node -d '^{1-8}'
# Send focused Node to workspace directionally
super + ctrl + shift + {Left,Right}
bspc node -d {prev,next} '--follow'
# Change focus of the Node or Swap Nodes
super + {_,shift + }{Left,Down,Up,Right}
bspc node -{f,s} {west,south,north,east}
# Move floating windows
super + alt + shift + {Left,Down,Up,Right}
bspc node -v {-25 0,0 25,0 -25,25 0}
# Expanding windows
super + control + {Left,Right,Up,Down}
bspc node -z {left -25 0,right 25 0,top 0 -25,bottom 0 25}
# Shrinking windows
super + alt + {Left,Right,Up,Down}
bspc node -z {left 25 0,right -25 0,top 0 25,bottom 0 -25}
# Split horizontal, vertical or cancel
super + {h,v,q}
bspc node -p {east,south,cancel}
# Preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# Toggle Layout (Tiled/Monocle)
super + l
bspc desktop -l next
# Toggle Fullscreen
super + f
bspc node -t "~"fullscreen
# Toggle beetwen floating & tiled
super + space
bspc node -t "~"{floating,tiled}
# Pseudo Tiled & tiled mode
super + shift + space
bspc node -t "~"{pseudo_tiled,tiled}
# Set the node flags
super + ctrl + {m,x,y,z}
bspc node -g {marked,locked,sticky,private}
# Change focus to next window, including floating window
alt + {_,shift + }Tab
bspc node -f {next.local,prev.local}
# Switch to last opened workspace
super + {Tab,grave}
bspc {node,desktop} -f last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment