nixconfig/home/xorg/bspwm/config.nix
2023-10-12 16:16:29 +02:00

317 lines
7.0 KiB
Nix
Executable File

{
config,
...
}: {
xsession.windowManager.bspwm.extraConfig = ''
#! /bin/bash
xrandr > /dev/shm/xrandr_output
sxhkd &
/nix/store/$(ls -la /nix/store | grep 'polkit-gnome' | grep '4096' | awk '{print $9}' | sed -n '$p')/libexec/polkit-gnome-authentication-agent-1 &
(xss-lock -- ~/.config/lock.sh || echo "AutoLock Hook Unavailable") &
wmname LG3D
export _IDISP=$(xrandr --query | grep " connected" | cut -d" " -f1 | grep "eDP" )
if [[ $(hostname) == 'Iriy' ]]; then
xrandr --output DP-0 --scale 1
xrandr --output DVI-I-0 --off --output DVI-I-1 --off --output HDMI-0 --off --output DP-0 --mode 3840x2160 --pos 1920x254 --rotate normal --scale 0.75 --primary --output DP-1 --off --output DP-2 --mode 1920x1080 --pos 0x0 --rotate normal --output DP-3 --off --output DP-4 --mode 1920x1080 --pos 4800x0 --rotate normal --output DP-5 --off
bspc monitor DP-4 -d 1
bspc monitor DP-2 -d 2 3
bspc monitor DP-0 -d 0 4 5 6 7 8 9
elif [[ $(hostname) == 'valinor' ]]; then
bspc monitor $_IDISP -d 1 2 3 4 5 6 7 8 9
else
bspc monitor $_IDISP -d 1 2 3 4 5 6 7 8 9
fi
bspc config remove_unplugged_monitors true
bspc config remove_disabled_monitors true
bspc config border_width 2
bspc config window_gap 6
bspc config split_ratio 0.52
bspc config borderless_monocle false
bspc config gapless_monocle false
bspc rule -a Screenkey manage=off
#bspc config super mod4
bspc config pointer_action1 move
bspc config pointer_action2 none
bspc config pointer_action3 resize_corner
#bspc config click_to_focus true
#bspc config focus_follows_pointer true
xsetroot -cursor_name left_ptr
feh --bg-fill ~/cloud/dark.jpg
xrdb ~/.Xressources
dunst &
eww open bar &
## Tab Global - Floating/Global Rules
bspc rule -a URxvt:yakuaki sticky=on state=floating hidden=on rectangle=$(($(xrandr --current | grep ' connected ' | uniq | awk '{print $4}' | cut -d 'x' -f1 | head -n1)-16))x600+$(($(xrandr --current | grep ' connected' | uniq | awk '{print $4}' | cut -d "+" -f2 | head -n1)+8))+$(($(xrandr --current | grep ' connected' | uniq | awk '{print $4}' | cut -d "+" -f3 | head -n1)+36))
urxvt -name yakuaki -e ~/.config/script/yakuaki &
kitty
bspc rule -a feh state=floating
bspc rule -a Confirm state=floating
bspc rule -a Preferences state=floating
bspc rule -a dialog state=floating
bspc rule -a menu state=floating
bspc rule -a task_dialog state=floating
bspc rule -a bubble state=floating
## Tab 8 - Various & Utility
bspc rule -a KeePassXC --one-shot desktop=8
bspc rule -a Nextcloud desktop=8
bspc rule -a Tk:tk desktop=8
## Tab 4 - Dev
bspc rule -a VSCodium desktop=4
## Tab 3 - Games & Movies
# ...
# ...
## Tab 2 - Coms Main
bspc rule -a TelegramDesktop desktop=2
bspc rule -a Instagram desktop=2
bspc rule -a lightcord desktop=2
bspc rule -a discord desktop=2
## Tab 1 - Internet
bspc rule -a Firefox --one-shot desktop=1
bspc rule -a firefox --one-shot desktop=1
bspc rule -a Google-chrome desktop=1
bspc rule -a Chromium=1
sh ~/.config/startup.sh
'';
xdg.configFile."startup.sh".text = ''
#!/bin/sh
bspc desktop -f 0
keepassxc --keyfile ~/.config/hcl.ico ~/cloud/kek.kdbx --pw-stdin <<< $(rofi -dmenu -password -i -no-fixed-num-lines -p "Password:" -theme themes/pass) &
sleep 2
bspc desktop -f 0
telegram-desktop &
nextcloud &
jellyfin-mpv-shim &
flameshot &
sleep 2
firefox &
ibus-daemon -drx
easyeffects --gapplication-service &
bspc desktop -f 0
'';
services.sxhkd.extraConfig = ''
super + Return
urxvt
# terminal floating
super + shift + Return
~/.config/script/toggle_yakuaki
# program launcher
super + d
rofi -modi "drun" -show drun
super + shift + d
rofi -show run
super + Tab
rofi -show window
super + Escape
pkill -USR1 -x sxhkd; \
notify-send "sxhkd config reloaded"
#
# bspwm hotkeys
#
# quit bspwm normally
super + alt + Escape
bspc quit
# close and kill
super + {_,shift + }w
bspc node -{c,k}
# alternate between the tiled and monocle layout
super + m
bspc desktop -l next
# if the current node is automatic, send it to the last manual, otherwise pull the last leaf
super + y
bspc query -N -n focused.automatic && bspc node -n last.!automatic || bspc node last.leaf -n focused
# swap the current node and the biggest node
super + g
bspc node -s biggest
#
# state/flags
#
# set the window state
super + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set the node flags
super + ctrl + {x,y,z}
bspc node -g {locked,sticky,private}
#
# focus/swap
#
# focus the node in the given direction
super + shift + {_,ctrl + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# focus the node for the given path jump
# super + {p,b,comma,period}
# bspc node -f @{parent,brother,first,second}
# focus the next/previous node
super + {_,shift + }c
bspc node -f {next,prev}
# focus the next/previous desktop
super + bracket{left,right}
bspc desktop -f {prev,next}
# focus the last node/desktop
super + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} {1-9,0}
# focus the next/previous node in the same window
super + {comma,period}
bspc node -f {next,prev}.local
#
# preselect
#
# preselect the direction
super + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
# preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
super + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
super + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
#
# move/resize
#
# expand a window by moving one of its side outward
super + alt + {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
super + alt + shift + {h,j,k,l}
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
super + {equal,minus}
bspc config window_gap $(( $(bspc config window_gap) {+,-} 5 ))
super + ctrl + {Left,Right,Up,Down}
bspc node @focused:/ --rotate {270,90,180,180}
super + shift + {Left,Right,Up,Down}
bspc node -f @parent; bspc node -R 90
# Screenshots
Print
flameshot gui
# Lock Desktop
super + l
~/.config/script/lock.sh
# Lock Alternative
super + k
xtrlock
# VOLUME
XF86AudioMute
pactl set-sink-mute @DEFAULT_SINK@ toggle
XF86AudioRaiseVolume
pactl set-sink-volume @DEFAULT_SINK@ +5%
XF86AudioLowerVolume
pactl set-sink-volume @DEFAULT_SINK@ -5%
# BRIGHTNESS
# Brightness goes up
#/home/gamehelp16/Documents/brightness -u
XF86MonBrightnessUp
brightnessctl set +16
# Brightness goes down
XF86MonBrightnessDown
brightnessctl set 16-
super + F1
pactl set-source-mute @DEFAULT_SOURCE@ toggle
XF86AudioMicMute
pactl set-source-mute @DEFAULT_SOURCE@ toggle
super + F7
~/.config/script/screens.sh
XF86Display
~/.config/script/screens.sh
'';
}