Better BSPWM binding

This commit is contained in:
Filippo Berto 2022-12-26 13:43:38 +01:00
parent 8ad70a9ada
commit 1f8c424512
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056
7 changed files with 43 additions and 37 deletions

View file

@ -1,11 +1,16 @@
{ pkgs, lib, ... }:
let
xsetroot = "${pkgs.xorg.xsetroot}/bin/xsetroot";
monitorPages = [ "" "" "" "" "" "" "" "" "" "" ];
monitorPagesString = lib.strings.concatStringsSep " " monitorPages;
monitorSetupScript = pkgs.writeShellScript "monitorSetupScript" ''
autorand -c || true
for monitor in $(bspc query -M --names); do
bspc monitor $monitor -d ${monitorPagesString}
done
'';
strPalette = pkgs.lib.rice.palette.toRGBHex pkgs.rice.colorPalette;
xrandr = "${pkgs.xorg.xrandr}/bin/xrandr";
xsetroot = "${pkgs.xorg.xsetroot}/bin/xsetroot";
in
{
xsession.windowManager.bspwm = {
@ -27,19 +32,12 @@ in
"Zathura" = { state = "tiled"; };
"Yad" = { state = "floating"; };
};
extraConfig = ''
${xsetroot} -solid black -cursor_name left_ptr
autorandr -c
for monitor in $(${xrandr} --listactivemonitors | cut -d " " -f 6); do
bspc monitor $monitor -d ${monitorPagesString}
done
systemctl --user restart \
polybar.service \
update-background.service
'';
startupPrograms = [ ];
startupPrograms = [
"${monitorSetupScript}" # Setup monitors
"systemctl --user restart polybar" # Restart polybar
"${xsetroot} -solid black -cursor_name left_ptr" # Set cursor
"${pkgs.update-background}/bin/update-background" # Set background
];
};
services = {
network-manager-applet.enable = true;

View file

@ -4,9 +4,9 @@
# blur = true;
# experimentalBackends = true;
fade = false;
shadow = true;
vSync = true;
# fade = false;
# shadow = true;
# vSync = true;
# settings = {
# blur =
# {
@ -15,13 +15,13 @@
# deviation = 7.0;
# };
# };
extraOptions = ''
blur:
{
method = "gaussian";
size = 10;
deviation = 7.0;
}
'';
# extraOptions = ''
# blur:
# {
# method = "gaussian";
# size = 10;
# deviation = 7.0;
# }
# '';
};
}

View file

@ -23,6 +23,9 @@
emojiChooser = "rofimoji --skin-tone light -a copy";
yad = "${pkgs.yad}/bin/yad";
notify = "${pkgs.libnotify}/bin/notify-send";
moveAllNodesToPrimary = pkgs.writeShellScript "moveAllNodesToPrimary" ''
comm -23 <(bspc query -N | sort) <(bspc query -m primary -N | sort) | while read n; do bspc node $n -m primary; done
'';
in
{
enable = true;
@ -32,9 +35,11 @@
"super + alt + {h,j,k,l}" = "bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
"super + alt + m" = "lockscreen";
"super + alt + p" = "autorandr -c";
"super + alt + shift + p" = "arandr";
"super + alt + q" = ''
${yad} --question --center --on-top --sticky --timeout=30 --timeout-indicator=bottom --image=gnome-shutdown --title "Shutdown" --text "Do you want to shutdown?" && bspc quit
'';
"super + alt + o" = "${moveAllNodesToPrimary}";
"super + alt + r" = "bspc wm -r";
"super + alt + {Right,Down,Left}" = "playerctl {next,play-pause,previous}";
"super + alt + shift + {h,j,k,l}" = "bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";