From 990c3925137378abafb91f4872804ff097ca27ef Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Tue, 18 Oct 2022 09:32:28 +0200 Subject: [PATCH] add background render screenshot --- nixos/system/desktop/home-manager/i3.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nixos/system/desktop/home-manager/i3.nix b/nixos/system/desktop/home-manager/i3.nix index 7f01cf0..3eed01a 100644 --- a/nixos/system/desktop/home-manager/i3.nix +++ b/nixos/system/desktop/home-manager/i3.nix @@ -11,6 +11,21 @@ let background = theme.base03; }; + + backgroundCommand = pkgs.writers.writeDash "background" '' + ${pkgs.xorg.xrandr}/bin/xrandr | grep " connected" | \ + ${pkgs.gnused}/bin/sed -E "s/primary //" | \ + ${pkgs.coreutils-full}/bin/cut -d' ' -f 3 | \ + ${pkgs.gnused}/bin/sed -E 's/\+.*$//g' | \ + ${pkgs.coreutils-full}/bin/sort -r | \ + ${pkgs.coreutils-full}/bin/head -n 1 | \ + ${pkgs.gawk}/bin/awk -F 'x' '{print "--width="$1" --height="$2}' | \ + ${pkgs.findutils}/bin/xargs \ + ${pkgs.polygon-art.polygon-art}/bin/rings \ + /dev/shm/background.png && \ + ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png + ''; + in { home-manager.users.mainUser = { @@ -183,6 +198,8 @@ in "${cfg.config.modifier}+Shift+f" = "floating toggle"; #"${cfg.config.modifier}+space" = "focus mode_toggle"; + "${cfg.config.modifier}+b" = "exec ${backgroundCommand}"; + "${cfg.config.modifier}+p" = "focus parent"; "${cfg.config.modifier}+Shift+minus" = "move scratchpad";