From 58225b75745fb6d14a92c299051d0d651a6b4839 Mon Sep 17 00:00:00 2001 From: "Agatha V. Lovelace" Date: Sun, 17 Sep 2023 18:57:46 +0200 Subject: [PATCH] Add desktop; various fixes --- common/fragments/graphical/bspwm.nix | 27 +- common/fragments/graphical/default.nix | 35 +- common/fragments/graphical/kitty.nix | 2 + common/fragments/graphical/polybar.nix | 77 +++- common/fragments/minecraft.nix | 2 +- common/home_manager/helix.nix | 2 +- flake.lock | 545 ++++++------------------- flake.nix | 93 +++-- hosts/ritual/configuration.nix | 31 +- hosts/tears/configuration.nix | 89 ++++ hosts/tears/hardware-configuration.nix | 56 +++ 11 files changed, 465 insertions(+), 494 deletions(-) create mode 100644 hosts/tears/configuration.nix create mode 100644 hosts/tears/hardware-configuration.nix diff --git a/common/fragments/graphical/bspwm.nix b/common/fragments/graphical/bspwm.nix index 75c4d38..d105998 100644 --- a/common/fragments/graphical/bspwm.nix +++ b/common/fragments/graphical/bspwm.nix @@ -8,9 +8,8 @@ "setxkbmap" ]; extraConfig = let - startOnce = procs: - map (v: "! pgrep ${builtins.head (lib.splitString " " v)} && ${v} &") - procs; + startOnce = + map (v: "! pgrep ${builtins.head (lib.splitString " " v)} && ${v} &"); startup = startOnce [ "firefox" "element-desktop" @@ -19,12 +18,13 @@ "geary" "bspm -d" ]; - in lib.strings.concatStringsSep "\n" ([ - "nitrogen --set-zoom-fill ${ - config.environment.graphical.colorschemes."${config.environment.graphical.theme.name}".image - }" - ] ++ startup); - monitors = { eDP-1 = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" ]; }; + monitors = builtins.genList (_: _) (builtins.length (builtins.attrValues + config.home-manager.users.agatha.xsession.windowManager.bspwm.monitors)); + nitrogen = map (i: + "nitrogen --head=${toString i} --set-zoom-fill ${ + config.environment.graphical.colorschemes."${config.environment.graphical.theme.name}".image + }") monitors; + in lib.strings.concatStringsSep "\n" (nitrogen ++ startup); settings = let color = n: config.environment.graphical.colors."${config.environment.graphical.theme.name}"."${builtins.toString @@ -47,15 +47,6 @@ state = "tiled"; follow = true; }; - "Element".desktop = "II"; - "TelegramDesktop".desktop = "III"; - "Spotify".desktop = "IV"; - "Geary".desktop = "V"; - "firefox" = { - desktop = "I"; - state = "tiled"; - follow = false; - }; "Yubico Authenticator".state = "floating"; "firefox:Places".state = "floating"; }; diff --git a/common/fragments/graphical/default.nix b/common/fragments/graphical/default.nix index e274af9..d7f3dd1 100644 --- a/common/fragments/graphical/default.nix +++ b/common/fragments/graphical/default.nix @@ -13,15 +13,26 @@ ./spotify.nix ]; + nixpkgs.overlays = [ + (final: prev: { + pads = final.callPackage ../../../common/pkgs/pads.nix { }; + bspm = final.callPackage ../../../common/pkgs/bspm.nix { }; + polybar-spotify = + final.callPackage ../../../common/pkgs/polybar-spotify.nix { }; + element-desktop = + prev.element-desktop.override { electron = prev.electron_24; }; + }) + ]; + # User packages users.users.agatha.packages = with pkgs; [ - (element-desktop.override { electron = electron_24; }) blueberry brightnessctl broot bspm clipmenu colmena + element-desktop ffmpeg flameshot gimp @@ -49,6 +60,7 @@ prismlauncher rofi-calc rofimoji + speechd tdesktop wireguard-tools xdg-utils @@ -137,6 +149,18 @@ arguments = [ "dimblur" ]; }; + # Update lockscreen wallpaper after locking + xdg.configFile."betterlockscreen/custom-post.sh".text = + "betterlockscreen -u ${ + config.environment.graphical.colorschemes."${config.environment.graphical.theme.name}".image + }"; + + # Send a notification 10 seconds before locking + services.screen-locker.xautolock.extraOptions = [ + "-notify 10" + "-notifier '${pkgs.dunst}/bin/dunstify -t 10000 -u 2 \"Screen will lock in 10 seconds\"'" + ]; + # GTK theme home.file.".themes" = { recursive = true; @@ -150,6 +174,8 @@ gtk = { enable = true; + font.name = "Cantarell"; + font.size = 12; theme.name = if config.environment.graphical.theme.light then "ZorinPurple-Light" else @@ -198,9 +224,7 @@ xdg.desktopEntries.element-work = { name = "Element @ Work"; icon = "im.riot.Riot"; - exec = "${ - (pkgs.element-desktop.override { electron = pkgs.electron_24; }) - }/bin/element-desktop --profile=work"; + exec = "${pkgs.element-desktop}/bin/element-desktop --profile=work"; categories = [ "Network" "InstantMessaging" "Chat" "VideoConference" ]; mimeType = [ "x-scheme-handler/element" ]; settings.StartupWMClass = "element"; @@ -273,4 +297,7 @@ enable = true; drivers = [ pkgs.hplip ]; }; + + # Fix Wireguard NetworkManager connections + networking.firewall.checkReversePath = "loose"; } diff --git a/common/fragments/graphical/kitty.nix b/common/fragments/graphical/kitty.nix index df3e355..b60c0e3 100644 --- a/common/fragments/graphical/kitty.nix +++ b/common/fragments/graphical/kitty.nix @@ -5,6 +5,8 @@ let n}"; in { home-manager.users.agatha = { + home.sessionVariables.TERMINAL = "kitty"; + programs.kitty = { enable = true; font = { diff --git a/common/fragments/graphical/polybar.nix b/common/fragments/graphical/polybar.nix index e80f9e2..734beea 100644 --- a/common/fragments/graphical/polybar.nix +++ b/common/fragments/graphical/polybar.nix @@ -11,6 +11,7 @@ "${pkgs.systemd}/bin" "${pkgs.util-linux}/bin" "${pkgs.gnused}/bin" + "${pkgs.kitty}/bin" ]); }; Install = { WantedBy = [ "graphical-session.target" ]; }; @@ -23,8 +24,6 @@ enable = true; package = pkgs.polybarFull; - script = "polybar right &"; - settings = let color = n: config.environment.graphical.colors."${config.environment.graphical.theme.name}"."${builtins.toString @@ -40,8 +39,7 @@ red = color 4; }; - "bar/right" = { - monitor = "\${env:MONITOR:eDP-1}"; + "bar/left" = { width = "100%:-30"; height = 30; offset-x = 15; @@ -80,7 +78,54 @@ modules = { left = "bspwm"; center = "date"; - right = + right = "spotify wireguard notification-status"; + }; + + wm-restack = "bspwm"; + cursor-click = "pointer"; + locale = "de_DE.UTF-8"; + }; + + "bar/right" = { + width = "100%:-30"; + height = 30; + offset-x = 15; + offset-y = 12; + radius = 0; + fixed-center = true; + + background = "\${colors.background}"; + foreground = "\${colors.foreground}"; + + line = { + size = 0; + color = color 3; + }; + border = { + size = 3; + color = color 1; + }; + padding = { + left = 2; + right = 2; + }; + module.margin = { + left = 1; + right = 1; + }; + + font = { + "0" = "Iosevka Gothic:pixelsize=10;3"; + "1" = "DejaVuSans:fontformat=truetype:size=8:antialias=false;2"; + "2" = "Siji:pixelsize=11;2"; + "3" = "Symbols Nerd Font:pixelsize=10;2"; + "4" = "DejaVuSans:fontformat=truetype:size=8:antialias=false;1"; + }; + + modules = { + left = "bspwm"; + center = "date"; + right = lib.mkDefault "filesystem battery pulseaudio xkeyboard memory cpu notification-status powermenu"; }; @@ -222,7 +267,7 @@ "0-0" = "reboot"; "0-0-exec" = "${pkgs.systemd}/bin/reboot"; "0-1" = "power off"; - "0-1-exec" = "sudo ${pkgs.systemd}/bin/poweroff"; + "0-1-exec" = "${pkgs.systemd}/bin/shutdown now"; }; }; @@ -270,6 +315,26 @@ interval = 2; format-prefix = " "; }; + + "module/wireguard" = { + type = "custom/script"; + exec = '' + ${pkgs.networkmanager}/bin/nmcli conn show --active | ${pkgs.ripgrep}/bin/rg -q wireguard && echo "VPN Connected" || echo ""''; + click-left = "kitty nmtui"; + interval = 5; + format-prefix = " "; + }; + + "module/spotify" = { + type = "custom/script"; + interval = 1; + exec = + "${pkgs.polybar-spotify}/bin/polybar-spotify -f '{artist}: {song}'"; + format-prefix = " "; + format = "