From 6d22fcfb8e16559935684f57a8b5622398e859b9 Mon Sep 17 00:00:00 2001 From: ChUrl Date: Thu, 25 May 2023 11:23:08 +0200 Subject: [PATCH] Link rofi configs to XDG_CONFIG_DIR depending on theme --- config/hyprland/hyprland.conf | 8 ++++---- config/rofi/menus/keybinds.fish | 2 +- config/rofi/menus/lectures.fish | 4 ++-- config/rofi/menus/power.fish | 2 +- config/rofi/menus/systemd-podman.fish | 4 ++-- config/rofi/menus/vpn.fish | 4 ++-- config/rofi/rofi.rasi | 2 +- home/christoph/default.nix | 1 + home/modules/rofi/default.nix | 22 +++++++++++----------- home/modules/rofi/options.nix | 6 ++++++ 10 files changed, 31 insertions(+), 24 deletions(-) diff --git a/config/hyprland/hyprland.conf b/config/hyprland/hyprland.conf index a914c589..3ec52ba3 100644 --- a/config/hyprland/hyprland.conf +++ b/config/hyprland/hyprland.conf @@ -80,12 +80,12 @@ $mainMod = SUPER bind = $mainMod, Q, killactive bind = $mainMod, V, togglefloating bind = $mainMod, F, fullscreen -bind = $mainMod, C, exec, clipman pick --tool=rofi --tool-args="-theme ~/NixFlake/config/rofi/rofi.rasi" # TODO: Theme + Generate this in a include file from nixos, depending on the menu option +bind = $mainMod, C, exec, clipman pick --tool=rofi # TODO: Theme + Generate this in a include file from nixos, depending on the menu option # Rofi -bind = $mainMod, A, exec, rofi -show drun -theme ~/NixFlake/config/rofi/rofi.rasi -bind = $mainMod, R, exec, rofi -show run -theme ~/NixFlake/config/rofi/rofi.rasi -bind = $mainMod, B, exec, rofi -show filebrowser -theme ~/NixFlake/config/rofi/rofi.rasi +bind = $mainMod, A, exec, rofi -show drun +# bind = $mainMod, R, exec, rofi -show run +# bind = $mainMod, B, exec, rofi -show filebrowser bind = $mainMod, D, exec, ~/NixFlake/config/rofi/menus/systemd-podman.fish bind = $mainMod, escape, exec, ~/NixFlake/config/rofi/menus/power.fish bind = $mainMod, O, exec, ~/NixFlake/config/rofi/menus/lectures.fish diff --git a/config/rofi/menus/keybinds.fish b/config/rofi/menus/keybinds.fish index 0566d44f..553597ac 100755 --- a/config/rofi/menus/keybinds.fish +++ b/config/rofi/menus/keybinds.fish @@ -1,3 +1,3 @@ #!/usr/bin/env fish -grep -E "^bind =" ~/NixFlake/config/hyprland/hyprland.conf | sd "bind = " "" | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "keys" -i \ No newline at end of file +grep -E "^bind =" ~/NixFlake/config/hyprland/hyprland.conf | sd "bind = " "" | rofi -dmenu -p " keys " -i \ No newline at end of file diff --git a/config/rofi/menus/lectures.fish b/config/rofi/menus/lectures.fish index 2397e8b3..4399ef54 100755 --- a/config/rofi/menus/lectures.fish +++ b/config/rofi/menus/lectures.fish @@ -1,13 +1,13 @@ #!/usr/bin/env fish # User chooses lecture -set LECTURE (exa -1 -D ~/Notes/TU | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "lecture" -i) +set LECTURE (exa -1 -D ~/Notes/TU | rofi -dmenu -p " lecture " -i) if test -z $LECTURE exit end # User chooses slides -set DECK (exa -1 ~/Notes/TU/$LECTURE/Lecture | grep ".pdf" | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "deck" -i) +set DECK (exa -1 ~/Notes/TU/$LECTURE/Lecture | grep ".pdf" | rofi -dmenu -p " deck " -i) if test -z $DECK exit end diff --git a/config/rofi/menus/power.fish b/config/rofi/menus/power.fish index 411f7ad5..51d5b1dd 100755 --- a/config/rofi/menus/power.fish +++ b/config/rofi/menus/power.fish @@ -2,7 +2,7 @@ # User chooses option set OPTIONS "Poweroff" "Reboot" "Reload Hyprland" "Exit Hyprland" -set OPTION (echo -e (string join "\n" $OPTIONS) | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "power" -i) +set OPTION (echo -e (string join "\n" $OPTIONS) | rofi -dmenu -p " power " -i) if not contains $OPTION $OPTIONS exit end diff --git a/config/rofi/menus/systemd-podman.fish b/config/rofi/menus/systemd-podman.fish index 57fd80f8..e4b37a4d 100755 --- a/config/rofi/menus/systemd-podman.fish +++ b/config/rofi/menus/systemd-podman.fish @@ -11,7 +11,7 @@ for SERVICE in $SERVICES set PROMPT $PROMPT"$SERVICE\n" end end -set SERVICE (echo -e $PROMPT | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "pod" -i -markup-rows) +set SERVICE (echo -e $PROMPT | rofi -dmenu -p " pod " -i -markup-rows) set SERVICE (echo -e $SERVICE | sd "<.*?>" "") if not contains $SERVICE $SERVICES exit @@ -19,7 +19,7 @@ end # User chooses action set ACTIONS "start" "stop" "restart" "status" -set ACTION (echo -e (string join "\n" $ACTIONS) | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "action" -i) +set ACTION (echo -e (string join "\n" $ACTIONS) | rofi -dmenu -p " action " -i) if not contains $ACTION $ACTIONS exit end diff --git a/config/rofi/menus/vpn.fish b/config/rofi/menus/vpn.fish index 4b339d05..32766126 100755 --- a/config/rofi/menus/vpn.fish +++ b/config/rofi/menus/vpn.fish @@ -11,7 +11,7 @@ for SERVER in $SERVERS set PROMPT $PROMPT"$SERVER\n" end end -set SERVER (echo -e $PROMPT | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "vpn" -i -markup-rows) +set SERVER (echo -e $PROMPT | rofi -dmenu -p " vpn " -i -markup-rows) set SERVER (echo -e $SERVER | sd "<.*?>" "") if not contains $SERVER $SERVERS exit @@ -19,7 +19,7 @@ end # User chooses action set ACTIONS "start" "stop" "status" -set ACTION (echo -e (string join "\n" $ACTIONS) | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "action" -i) +set ACTION (echo -e (string join "\n" $ACTIONS) | rofi -dmenu -p " action " -i) if not contains $ACTION $ACTIONS exit end diff --git a/config/rofi/rofi.rasi b/config/rofi/rofi.rasi index 9f3b95be..1bd5444d 100644 --- a/config/rofi/rofi.rasi +++ b/config/rofi/rofi.rasi @@ -16,7 +16,7 @@ configuration{ sidebar-mode: false; } -@import "colors/three-bears.rasi" +@theme "colors.rasi" element-text, element-icon, diff --git a/home/christoph/default.nix b/home/christoph/default.nix index af1963c3..e1c0ad90 100644 --- a/home/christoph/default.nix +++ b/home/christoph/default.nix @@ -170,6 +170,7 @@ rec { rofi = { enable = true; + theme = "Three-Bears"; }; vscode.enable = true; diff --git a/home/modules/rofi/default.nix b/home/modules/rofi/default.nix index 724cd548..1256952d 100644 --- a/home/modules/rofi/default.nix +++ b/home/modules/rofi/default.nix @@ -15,18 +15,18 @@ in { options.modules.rofi = import ./options.nix {inherit lib mylib;}; config = mkIf cfg.enable { - programs.rofi = { - enable = true; - package = pkgs.rofi-wayland; - plugins = [ - pkgs.keepmenu # TODO: Rofi KeepassXC frontend - ]; + home.packages = with pkgs; [ + rofi-wayland + ]; - # NOTE: Don't use this, use the configfile for hot-reload - # terminal = "${pkgs.kitty}/bin/kitty"; - # font = "JetBrains Mono 14"; - # theme = - # extraConfig = ''''; + home.activation = { + # NOTE: Keep the rofi config symlinked, to allow easy changes with hotreload + linkRofiConfig = + hm.dag.entryAfter ["writeBoundary"] + (mkLink "~/NixFlake/config/rofi/rofi.rasi" "~/.config/rofi/config.rasi"); + linkRofiColors = + hm.dag.entryAfter ["writeBoundary"] + (mkLink "~/NixFlake/config/rofi/colors/${cfg.theme}.rasi" "~/.config/rofi/colors.rasi"); }; }; } diff --git a/home/modules/rofi/options.nix b/home/modules/rofi/options.nix index c8fe728a..082a8a0d 100644 --- a/home/modules/rofi/options.nix +++ b/home/modules/rofi/options.nix @@ -6,4 +6,10 @@ with lib; with mylib.modules; { enable = mkEnableOpt "Rofi"; + + theme = mkOption { + type = types.str; + example = "Three-Bears"; + description = "Color theme to use"; + }; }