🧹 restructure layout

This commit is contained in:
Moritz Böhme 2022-07-15 13:11:54 +02:00
parent 40c2a5fb29
commit 268374ad58
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
115 changed files with 2641 additions and 2085 deletions

11
modules/programs/bspwm/bspwmrc Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
mapfile -t monitors < <(bspc query -M --names | sort -r)
desktops=$(( 10 / ${#monitors[@]} ))
start=1
end=$desktops
for monitor in "${monitors[@]}"; do
bspc monitor "$monitor" -d $(seq -s ' ' $start $end)
start=$(( start + desktops ))
end=$(( end + desktops ))
done

View file

@ -0,0 +1,79 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.bspwm;
in
{
options.my.programs.bspwm = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = lib.mkIf cfg.enable {
services = {
xserver = {
enable = true;
layout = "de";
displayManager = {
defaultSession = "none+bspwm";
autoLogin = {
enable = true;
user = "moritz";
};
lightdm.enable = true;
};
windowManager.bspwm.enable = true;
};
};
home-manager.users.moritz = {
xsession.windowManager.bspwm = {
enable = true;
rules = {
"Zathura".state = "tiled";
"Emacs".state = "tiled";
"feh".state = "floating";
"Vampire_Survivors".state = "fullscreen";
};
settings = with config.scheme.withHashtag; {
border_width = 2;
window_gap = 5;
borderless_monocle = true;
gapless_monocle = true;
focus_follows_pointer = true;
};
startupPrograms = [
"${pkgs.systemd}/bin/systemctl --user start polybar.service"
"randomWallpaper"
"synology-drive"
];
extraConfig = builtins.readFile ./bspwmrc;
};
services = {
sxhkd = {
enable = true;
extraConfig = builtins.readFile ./sxhkdrc;
};
polybar = {
enable = true;
package = pkgs.polybar.override { pulseSupport = true; };
script = ''
for m in $(polybar --list-monitors | ${pkgs.coreutils}/bin/cut -d":" -f1); do
MONITOR=$m polybar --reload bottom &
done
'';
};
};
home.packages = with pkgs; [ feh playerctl pamixer brightnessctl ];
};
};
}

116
modules/programs/bspwm/sxhkdrc Executable file
View file

@ -0,0 +1,116 @@
# BSPWM
# Uses modifier key ALT
# Desktop
# View desktop
alt + {1-9,0}
bspc desktop -f {1-9,10}
# Move node to desktop
alt + shift + {1-9,0}
bspc node -d {1-9,10}
# WM
# quit/restart bspwm
alt + shift + {e,r}
bspc {quit,wm -r}
# close/kill node
alt + {_,shift + }q
bspc node -{c,k}
# make sxhkd reload its configuration files:
alt + shift + c
pkill -USR1 -x sxhkd && dunstify 'sxhkd' 'Reloaded config!'
# State and Flags
# set the window state
alt + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# Focus/Swap Nodes
# focus the node in the given direction
alt + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# Rotate tree
alt + shift + {d,a}
bspc node @/ -C {forward,backward}
# Resize Node
# expand a window by moving one of its side outward
alt + ctrl + {h,j,k,l}
bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# contract a window by moving one of its side inward
alt + shift + ctrl + {h,j,k,l}
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# XF86 Keys
XF86AudioRaiseVolume
pamixer -i 5
XF86AudioLowerVolume
pamixer -d 5
XF86AudioMute
pamixer -t
XF86AudioPlay
[ $(playerctl -p "spotifyd,firefox" status) = "Playing" ] && playerctl -p "spotifyd,firefox" pause || playerctl -p "spotifyd,firefox" play
XF86AudioNext
playerctl -p "spotifyd,firefox" next
XF86AudioPrev
playerctl -p "spotifyd,firefox" previous
XF86MonBrightnessDown
brightnessctl s 10%-
XF86MonBrightnessUp
brightnessctl s +10%
# Programs
# Uses modifier key SUPER
# Rofi
# start rofi
super + d
rofi -show combi
# start Networkmanager rofi
super + w
networkmanager_dmenu
# start rofi-calc
super + c
rofi -show calc -modi calc -no-show-match -no-sort | xclip -selection clipboard
# Show help
super + h
sxhkd-help
# script for sharing files
super + s
share
# Apps
# start firefox
super + {_,shift} + f
firefox {_,--private-window}
# terminal emulator
super + {_,shift} + Return
{_,bspc rule -a "kitty" -o state=floating;} kitty
# Emacs
# start emacs
super + e
emacsclient -c -a emacs
# emacs everywhere
super + shift + e
bspc rule -a 'Emacs' -o state=floating sticky=on; \
emacsclient --eval "(emacs-everywhere)"