From 8e689038db930f74c6e38969f52e508d5a51865a Mon Sep 17 00:00:00 2001 From: derped Date: Sat, 9 Sep 2023 21:18:53 +0200 Subject: [PATCH] Add basic rofi config. --- config/etc.nix | 3 ++- config/etc/i3/config.nix | 3 +-- config/etc/rofi.rasi.nix | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 config/etc/rofi.rasi.nix diff --git a/config/etc.nix b/config/etc.nix index 8215bf3..2eb6121 100644 --- a/config/etc.nix +++ b/config/etc.nix @@ -1,9 +1,10 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: with lib; { environment.etc = mkIf (elem "etcfiles" config.machine.conffiles) { + "rofi.rasi".source = (import ./etc/rofi.rasi.nix { inherit pkgs; }); "i3/py3status".source = ./etc/i3/py3status; "sway/config".source = mkDefault ./etc/sway/config; "mpv/input.conf".source = ./etc/mpv/input.conf; diff --git a/config/etc/i3/config.nix b/config/etc/i3/config.nix index 8b7d4c9..85ac971 100644 --- a/config/etc/i3/config.nix +++ b/config/etc/i3/config.nix @@ -149,8 +149,7 @@ bindsym $mod+Return exec alacritty bindsym $mod+Shift+q kill # start dmenu (a program launcher) -#bindsym $mod+d exec rofi -show run -lines 3 -eh 2 -width 100 -padding 330 -opacity "85" -config ~/.config/rofi.cfg -font "System San Francisco Display 12" -bindsym $mod+d exec dmenu_run -fn 'Droid Sans Mono-8' +bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -config /etc/rofi.rasi -show combi # There also is the (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. diff --git a/config/etc/rofi.rasi.nix b/config/etc/rofi.rasi.nix new file mode 100644 index 0000000..b1e8513 --- /dev/null +++ b/config/etc/rofi.rasi.nix @@ -0,0 +1,25 @@ +{ pkgs }: + +let + tabMode = pkgs.writeScript "tab-finder.sh" (with pkgs; '' + #!/usr/bin/env bash + if [ -z ''${1} ]; then + ${brotab}/bin/bt list; + else + TARGET_TAB=$(sed "s/\t.*$//g" <<< ''${1}); + # activate window as focused to it is easy to switch to + ${brotab}/bin/bt activate --focused ''${TARGET_TAB} > /dev/null 2>&1; + ${i3}/bin/i3-msg -t run_command "[urgent=latest] focus" > /dev/null 2>&1; + fi + exit 0; + ''); +in (pkgs.writeText "rofi.rasi" '' +configuration { + modi: "combi,window,drun,ssh,tabFinder:${tabMode}"; + font: "hack 10"; + combi-modi: "window,drun,ssh,tabFinder"; + icon-theme: "Papirus"; + show-icons: true; +} +@theme "solarized" +'')