From 71718f1981a68ff47ada5f1846c75831c41d408c Mon Sep 17 00:00:00 2001 From: Leon Vatthauer Date: Sun, 9 Mar 2025 19:59:58 +0100 Subject: [PATCH] make eww more reusable, tinker with doom emacs and agda --- gunther/configuration.nix | 3 -- gunther/doom/config.el | 6 +-- gunther/doom/init.el | 2 +- gunther/leonv.nix | 29 +--------- modules/hyprland/default.nix | 46 ++++++++++++++-- .../hyprland}/eww/config/eww.scss | 0 .../hyprland}/eww/config/eww.yuck | 53 +++++++++++-------- .../eww/config/widgets/resources/eww.yuck | 0 .../eww/config/widgets/resources/network.sh | 0 .../eww/config/widgets/window-title/eww.yuck | 0 .../widgets/window-title/get-window-title.sh | 0 .../workspaces/change-active-workspace.sh | 0 .../eww/config/widgets/workspaces/eww.yuck | 0 .../workspaces/get-active-workspace.sh | 0 .../widgets/workspaces/get-workspaces.sh | 0 {gunther => modules/hyprland}/eww/default.nix | 1 + 16 files changed, 80 insertions(+), 60 deletions(-) rename {gunther => modules/hyprland}/eww/config/eww.scss (100%) rename {gunther => modules/hyprland}/eww/config/eww.yuck (68%) mode change 100755 => 100644 rename {gunther => modules/hyprland}/eww/config/widgets/resources/eww.yuck (100%) rename {gunther => modules/hyprland}/eww/config/widgets/resources/network.sh (100%) rename {gunther => modules/hyprland}/eww/config/widgets/window-title/eww.yuck (100%) rename {gunther => modules/hyprland}/eww/config/widgets/window-title/get-window-title.sh (100%) rename {gunther => modules/hyprland}/eww/config/widgets/workspaces/change-active-workspace.sh (100%) rename {gunther => modules/hyprland}/eww/config/widgets/workspaces/eww.yuck (100%) rename {gunther => modules/hyprland}/eww/config/widgets/workspaces/get-active-workspace.sh (100%) rename {gunther => modules/hyprland}/eww/config/widgets/workspaces/get-workspaces.sh (100%) rename {gunther => modules/hyprland}/eww/default.nix (60%) diff --git a/gunther/configuration.nix b/gunther/configuration.nix index a879f39..1bf8795 100755 --- a/gunther/configuration.nix +++ b/gunther/configuration.nix @@ -21,9 +21,6 @@ # Docker virtualisation.docker.enable = true; - services.emacs.package = pkgs.emacs29-pgtk; - services.emacs.enable = true; - # optimize power usage powerManagement.enable = true; diff --git a/gunther/doom/config.el b/gunther/doom/config.el index 6077ddc..2f09e76 100755 --- a/gunther/doom/config.el +++ b/gunther/doom/config.el @@ -78,7 +78,6 @@ ;; ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; they are implemented. -(envrc-global-mode) (setq +latex-viewers '(pdf-tools)) (eval-after-load "tex" '(add-to-list 'TeX-command-list @@ -87,7 +86,6 @@ (pdf-tools-install) (evil-global-set-key 'normal (kbd "SPC t t") #'treemacs) ;; The following is a hack to use the right agda version for my thesis... -;; (load-file "/nix/store/38cw6va0dhln7gknwsz7ghazlcldjgdc-Agda-2.6.3-data/share/ghc-9.2.8/x86_64-linux-ghc-9.2.8/Agda-2.6.3/emacs-mode/agda2.el") -;;(load-file (let ((coding-system-for-read 'utf-8)) -;; (shell-command-to-string "agda-mode locate"))) +(load-file "/nix/store/p2b07qnkw664ni99is80ja4hvynllhw8-Agda-2.7.0.1-data/share/ghc-9.6.6/x86_64-linux-ghc-9.6.6/Agda-2.7.0.1/emacs-mode/agda2.el") (add-to-list 'auto-mode-alist '("\\.lagda.md\\'" . agda2-mode)) +(envrc-global-mode) diff --git a/gunther/doom/init.el b/gunther/doom/init.el index dea56d3..94618e2 100755 --- a/gunther/doom/init.el +++ b/gunther/doom/init.el @@ -114,7 +114,7 @@ ;;tty ; improve the terminal Emacs experience :lang - (agda +local) ; types of types of types of types... + ;;(agda +local) ; types of types of types of types... ;;beancount ; mind the GAAP ;;(cc +lsp) ; C > C++ == 1 ;;clojure ; java with a lisp diff --git a/gunther/leonv.nix b/gunther/leonv.nix index 74df1ac..43cf995 100755 --- a/gunther/leonv.nix +++ b/gunther/leonv.nix @@ -2,9 +2,7 @@ { imports = [ ./../common - # ./hypr/hyprland.nix ./../modules/hyprland - ./eww ]; /* The home.stateVersion option does not have a default and must be set */ home.stateVersion = "24.11"; @@ -30,14 +28,6 @@ home.packages = with pkgs; [ prismlauncher - # theme for gtk applications - orchis-theme - (catppuccin-gtk.override { - accents = [ "flamingo" ]; - size = "compact"; - tweaks = [ "rimless" "black" ]; - variant = "macchiato"; - }) # smt solver for liquid haskell z3 @@ -91,24 +81,6 @@ anki pandoc - # hyprland - kitty - networkmanagerapplet - mako - libnotify - pavucontrol - hyprpaper - qimgv - playerctl - hyprpicker - wev - inputs.hyprland-contrib.packages.${pkgs.system}.grimblast - bluez - htop - file-roller - zip - unzip - # yubikey yubico-pam yubikey-manager @@ -124,6 +96,7 @@ # for emacs texlab shellcheck + emacs ]; xdg.configHome = /home/leonv/.config; diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index a7cbf11..bb2d004 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -1,13 +1,23 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, inputs, ... }: with lib; with types; let cfg = config.modules.hyprland; in { + imports = [ + ./eww + ]; options.modules.hyprland = { enable = mkEnableOption "Hyprland Wrapper"; + # eww + oled = mkOption { + type = bool; + description = ''Special theming for OLED monitors.''; + default = false; + }; + # monitor setup monitor = mkOption { type = listOf str; @@ -33,7 +43,7 @@ in hyprpaper = { enable = mkEnableOption "Hyprpaper wrapper"; wallpaper = mkOption { - type = types.path; + type = path; default = []; description = '' Wallpaper to be set on every monitor @@ -50,6 +60,35 @@ in # TODO start script config = mkIf cfg.enable { + home.packages = with pkgs; [ + # hyprland + kitty + networkmanagerapplet + mako + libnotify + pavucontrol + hyprpaper + qimgv + playerctl + hyprpicker + wev + inputs.hyprland-contrib.packages.${pkgs.system}.grimblast + bluez + htop + file-roller + zip + unzip + # theme for gtk applications + orchis-theme + (catppuccin-gtk.override { + accents = [ "flamingo" ]; + size = "compact"; + tweaks = [ "rimless" "black" ]; + variant = "macchiato"; + }) + ]; + + services.hyprpaper = mkIf cfg.hyprpaper.enable { enable = true; settings = { @@ -162,7 +201,7 @@ in "$mod, C, togglespecialworkspace, scratchpad" # status bar - "$mod, T, exec, eww open --toggle top-bar" + "$mod, T, exec, eww open --toggle top-bar --arg oled=${if cfg.oled then "true" else "false"}" ]; bindm = [ "$mod, mouse:272, movewindow" @@ -175,6 +214,7 @@ in exec-once = [ "bash ~/Git/nixos/modules/hyprland/start.sh" "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + "${if cfg.oled then "" else "eww open --toggle top-bar --arg oled=false"}" ]; }; }; diff --git a/gunther/eww/config/eww.scss b/modules/hyprland/eww/config/eww.scss similarity index 100% rename from gunther/eww/config/eww.scss rename to modules/hyprland/eww/config/eww.scss diff --git a/gunther/eww/config/eww.yuck b/modules/hyprland/eww/config/eww.yuck old mode 100755 new mode 100644 similarity index 68% rename from gunther/eww/config/eww.yuck rename to modules/hyprland/eww/config/eww.yuck index c44facd..4f8fb2b --- a/gunther/eww/config/eww.yuck +++ b/modules/hyprland/eww/config/eww.yuck @@ -1,25 +1,7 @@ ; inspired by https://github.com/saimoomedits/eww-widgets/tree/main - -(include "./widgets/workspaces/eww.yuck") -(include "./widgets/window-title/eww.yuck") -(include "./widgets/resources/eww.yuck") - -(defwindow top-bar - :monitor 0 - :geometry (geometry :x "0%" - :y "10px" - :width "98.8%" - :height "30px" - :anchor "top center") - :stacking "fg" - :exclusive true - (centerbox - :class "bar" - (left) - (center) - (right) - ) -) +(include "widgets/workspaces/eww.yuck") +(include "widgets/window-title/eww.yuck") +(include "widgets/resources/eww.yuck") (defwidget left [] (box @@ -52,3 +34,32 @@ (bluetooth) (datetime) )) + +(defwidget top-bar-oled [] + (centerbox + :class "oled" + (left) + (right) + ) +) + +(defwidget top-bar-non-oled [] + (centerbox + :class "non-oled" + (left) + (center) + (right) + ) +) + +(defwindow top-bar [oled] + :monitor 0 + :geometry (geometry :x "0%" + :y "10px" + :width "98.8%" + :height "30px" + :anchor "top center") + :stacking "fg" + :exclusive true + (literal :content {oled ? "(top-bar-oled)" : "(top-bar-non-oled)"}) +) \ No newline at end of file diff --git a/gunther/eww/config/widgets/resources/eww.yuck b/modules/hyprland/eww/config/widgets/resources/eww.yuck similarity index 100% rename from gunther/eww/config/widgets/resources/eww.yuck rename to modules/hyprland/eww/config/widgets/resources/eww.yuck diff --git a/gunther/eww/config/widgets/resources/network.sh b/modules/hyprland/eww/config/widgets/resources/network.sh similarity index 100% rename from gunther/eww/config/widgets/resources/network.sh rename to modules/hyprland/eww/config/widgets/resources/network.sh diff --git a/gunther/eww/config/widgets/window-title/eww.yuck b/modules/hyprland/eww/config/widgets/window-title/eww.yuck similarity index 100% rename from gunther/eww/config/widgets/window-title/eww.yuck rename to modules/hyprland/eww/config/widgets/window-title/eww.yuck diff --git a/gunther/eww/config/widgets/window-title/get-window-title.sh b/modules/hyprland/eww/config/widgets/window-title/get-window-title.sh similarity index 100% rename from gunther/eww/config/widgets/window-title/get-window-title.sh rename to modules/hyprland/eww/config/widgets/window-title/get-window-title.sh diff --git a/gunther/eww/config/widgets/workspaces/change-active-workspace.sh b/modules/hyprland/eww/config/widgets/workspaces/change-active-workspace.sh similarity index 100% rename from gunther/eww/config/widgets/workspaces/change-active-workspace.sh rename to modules/hyprland/eww/config/widgets/workspaces/change-active-workspace.sh diff --git a/gunther/eww/config/widgets/workspaces/eww.yuck b/modules/hyprland/eww/config/widgets/workspaces/eww.yuck similarity index 100% rename from gunther/eww/config/widgets/workspaces/eww.yuck rename to modules/hyprland/eww/config/widgets/workspaces/eww.yuck diff --git a/gunther/eww/config/widgets/workspaces/get-active-workspace.sh b/modules/hyprland/eww/config/widgets/workspaces/get-active-workspace.sh similarity index 100% rename from gunther/eww/config/widgets/workspaces/get-active-workspace.sh rename to modules/hyprland/eww/config/widgets/workspaces/get-active-workspace.sh diff --git a/gunther/eww/config/widgets/workspaces/get-workspaces.sh b/modules/hyprland/eww/config/widgets/workspaces/get-workspaces.sh similarity index 100% rename from gunther/eww/config/widgets/workspaces/get-workspaces.sh rename to modules/hyprland/eww/config/widgets/workspaces/get-workspaces.sh diff --git a/gunther/eww/default.nix b/modules/hyprland/eww/default.nix similarity index 60% rename from gunther/eww/default.nix rename to modules/hyprland/eww/default.nix index 1cf6995..5e35d1b 100755 --- a/gunther/eww/default.nix +++ b/modules/hyprland/eww/default.nix @@ -1,5 +1,6 @@ { pkgs, ... }: { + # TODO choose oled or non-oled depending on some set variable programs.eww = { enable = true; configDir = ./config;