nix-dotfiles/modules/bspwm.nix
2021-07-19 07:57:47 +02:00

74 lines
2.2 KiB
Nix

{ pkgs, ... }:
let
monitorPages = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX" "X" ];
strPalette = pkgs.rice.palette.toRGBHex pkgs.rice.colorPalette;
xrandr = "${pkgs.xorg.xrandr}/bin/xrandr";
in
{
xsession.windowManager.bspwm = {
enable = true;
settings = {
border_width = 2;
border_radius = 8;
window_gap = 4;
split_ratio = 0.5;
top_padding = 0;
borderless_monocle = true;
gapless_monocle = false;
normal_border_color = strPalette.normal.blue;
focused_border_color = strPalette.bright.blue;
};
monitors = {
# Intel
"eDP1" = monitorPages;
"DP1" = monitorPages;
# Nvidia
"eDP-1-1" = monitorPages;
"HDMI-0" = monitorPages;
"DP-1-1" = monitorPages;
};
extraConfig = ''
${pkgs.wmname}/bin/wmname LG3D
${pkgs.polybar}/bin/polybar-msg cmd restart
if grep DP-1-1 <(${xrandr} --listactivemonitors); then
${xrandr} --output DP-1-1 --auto --left-of HDMI-0 --rotate right ||
${xrandr} --output DP-1-1 --auto --left-of eDP-1-1 --rotate right
elif grep DP1 <(${xrandr} --listactivemonitors); then
${xrandr} --output DP-1-1 --auto --above eDP1;
fi
systemctl --user restart polybar.service update-background.service || true
'';
startupPrograms = [];
};
# xdg.configFile."bspwm/bspwmrc" = {
# executable = true;
# text = ''
# #!/bin/sh
# bspc monitor DP1 -d I II III IV V VI VII VIII IX X
# bspc monitor HDMI-0 -d I II III IV V VI VII VIII IX X
# bspc monitor eDP-1-1 -d I II III IV V VI VII VIII IX X
# bspc monitor eDP1 -d I II III IV V VI VII VIII IX X
# bspc config border_radius 8
# bspc config border_width 2
# bspc config borderless_monocle true
# bspc config focused_border_color '#678EBD'
# bspc config gapless_monocle false
# bspc config normal_border_color '#5E81AC'
# bspc config split_ratio 0.500000
# bspc config top_padding 0
# bspc config window_gap 4
# # java gui fixes
# export _JAVA_AWT_WM_NONREPARENTING=1
# bspc rule -a sun-awt-X11-XDialogPeer state=floating
# sleep 2
# polybar-msg cmd restart
# '';
# };
}