From 73f874f00014791109fd5c967e86c42e95ede843 Mon Sep 17 00:00:00 2001 From: Aria Nolan Date: Tue, 14 Nov 2023 23:51:07 -0500 Subject: [PATCH] waybar............. gtk............... --- flake.nix | 1 + hosts/JWST/configuration.nix | 12 ++-- modules/sway.nix | 63 +++++++++++++++++++ users/tacocat/helix/languages.nix | 4 +- users/tacocat/wayland/default.nix | 4 ++ users/tacocat/wayland/sway/config | 33 ++++++---- users/tacocat/wayland/sway/config.d/autostart | 2 +- users/tacocat/wayland/waybar/default.nix | 1 + 8 files changed, 98 insertions(+), 22 deletions(-) create mode 100644 modules/sway.nix diff --git a/flake.nix b/flake.nix index e7bcadf..8aabbf8 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,7 @@ specialArgs = {inherit inputs;}; modules = [ ./hosts/JWST/configuration.nix + ./modules/sway.nix nixos-hardware.nixosModules.dell-xps-15-9520 nixos-hardware.nixosModules.common-gpu-nvidia-disable { nixpkgs.overlays = overlays; } diff --git a/hosts/JWST/configuration.nix b/hosts/JWST/configuration.nix index 5e7b78a..ccc317d 100644 --- a/hosts/JWST/configuration.nix +++ b/hosts/JWST/configuration.nix @@ -92,12 +92,12 @@ brightnessctl ]; - programs.sway.enable = true; - programs.sway.extraPackages = with pkgs; [ - swaylock - swayidle - brightnessctl - ]; + # programs.sway.enable = true; + # programs.sway.extraPackages = with pkgs; [ + # swaylock + # swayidle + # brightnessctl + # ]; # programs.waybar.enable = true; # programs.nm-applet.enable = true; diff --git a/modules/sway.nix b/modules/sway.nix new file mode 100644 index 0000000..a1d5b9c --- /dev/null +++ b/modules/sway.nix @@ -0,0 +1,63 @@ +{ + config, + pkgs, + lib, + ... +}: let + # bash script to let dbus know about important env variables and + # propagate them to relevent services run at the end of sway config + # see + # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist + # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts + # some user services to make sure they have the correct environment variables + dbus-sway-environment = pkgs.writeTextFile { + name = "dbus-sway-environment"; + destination = "/bin/dbus-sway-environment"; + executable = true; + + text = '' + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + systemctl --user stop pipewire xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk + systemctl --user start pipewire xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk + ''; + }; + + # currently, there is some friction between sway and gtk: + # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland + # the suggested way to set gtk settings is with gsettings + # for gsettings to work, we need to tell it where the schemas are + # using the XDG_DATA_DIR environment variable + # run at the end of sway config + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + # gsettings set $gnome_schema gtk-theme 'Dracula' + ''; + }; +in { + # environment.systemPackages = [ + # dbus-sway-environment + # configure-gtk + # ]; + + # enable sway window manager + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + extraPackages = with pkgs; [ + dbus-sway-environment + configure-gtk + swaylock + swayidle + brightnessctl + ]; + }; + # programs.waybar.enable = true; +} diff --git a/users/tacocat/helix/languages.nix b/users/tacocat/helix/languages.nix index a6b8031..f8594a6 100644 --- a/users/tacocat/helix/languages.nix +++ b/users/tacocat/helix/languages.nix @@ -44,10 +44,10 @@ texlab = { command = "${pkgs.texlab}/bin/texlab"; config.texlab = { - forwardSearch.executable = "${pkgs.zathura}"; + forwardSearch.executable = lib.getExe pkgs.zathura; forwardSearch.args = ["--synctex-forward" "%l:1:%f"]; build = { - executable = "${pkgs.tectonic}/bin/tectonic"; + executable = lib.getExe pkgs.tectonic; onSave = true; auxDirectory = "build"; logDirectory = "build"; diff --git a/users/tacocat/wayland/default.nix b/users/tacocat/wayland/default.nix index 1f07dc8..751eb50 100644 --- a/users/tacocat/wayland/default.nix +++ b/users/tacocat/wayland/default.nix @@ -21,6 +21,10 @@ xdg.configFile."sway/background.jpg".source = ../background.jpg; + # wayland.windowManager.sway = { + # enable = true; + # }; + home.packages = with pkgs; [ wl-clipboard # swaylock diff --git a/users/tacocat/wayland/sway/config b/users/tacocat/wayland/sway/config index 8a8e620..3994c7e 100755 --- a/users/tacocat/wayland/sway/config +++ b/users/tacocat/wayland/sway/config @@ -1,13 +1,13 @@ # Default config for sway -include ~/.config/sway/config.d/* -include /etc/sway/config.d/* - # # Copy this to ~/.config/sway/config and edit it to your liking. # # Read `man 5 sway` for a complete reference. +exec dbus-sway-environment +# exec configure-gtk + ### Variables # # Logo key. Use Mod1 for Alt. @@ -53,7 +53,6 @@ client.unfocused $unfocus $unfocus $unfocus $unfocus # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) output * bg ~/.config/sway/background.jpg fill -bar swaybar_command waybar # # Example configuration: # @@ -237,20 +236,23 @@ bindsym $mod+r mode "resize" # # Status Bar: +bar { + + swaybar_command swaybar # # Read `man 5 sway-bar` for more information about this section. -# position top + position top # # When the status_command prints a new line to stdout, swaybar updates. # # The default just shows the current date and time. -# status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done + status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done -# colors { -# statusline #ffffff -# background #323232 -# inactive_workspace #32323200 #32323200 #5c5c5c -# } -# } + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } + } # # Player @@ -278,4 +280,9 @@ bindsym $mod+r mode "resize" # SwayFX # blur on -# xwayland enable +xwayland enable + + +# include /etc/sway/config.d/* + +include ~/.config/sway/config.d/* diff --git a/users/tacocat/wayland/sway/config.d/autostart b/users/tacocat/wayland/sway/config.d/autostart index ef2e24b..4e8dcb8 100755 --- a/users/tacocat/wayland/sway/config.d/autostart +++ b/users/tacocat/wayland/sway/config.d/autostart @@ -1,7 +1,7 @@ exec nm-applet -# exec waybar exec gammastep-indicator exec dunst +# exec waybar #exec swayidle -w \ # timeout 600 'swaylock -f -c 14171d' \ # before-sleep 'swaylock -f -c 14171d' diff --git a/users/tacocat/wayland/waybar/default.nix b/users/tacocat/wayland/waybar/default.nix index 0dd7995..99eafaa 100644 --- a/users/tacocat/wayland/waybar/default.nix +++ b/users/tacocat/wayland/waybar/default.nix @@ -2,6 +2,7 @@ programs.waybar = { enable = true; style = ./style.css; + # systemd.enable = true; settings = { mainBar = { layer = "top";