fixing some niri issues

This commit is contained in:
Chris Cochrun 2026-01-28 10:30:23 -06:00
parent bf71afb8b5
commit 5d4ce7bfe3
2 changed files with 22 additions and 12 deletions

View file

@ -10,6 +10,21 @@ let
systemctl --user restart syncthingtray
systemctl --user restart nextcloud-client
'';
nirilof = pkgs.writeShellScriptBin "nirilof" ''
app=$1
command=$2
id=$(${pkgs.nushell}/bin/nu -c "niri msg --json windows | from json | where app_id == $app | get id | first")
if [ $id -gt 0 ]; then
niri msg action focus-window --id $id
else
$command & disown
fi
'';
cosmic-extra-niri = pkgs.writeShellScriptBin "cosmic-extra-niri" ''
set -e
@ -106,9 +121,9 @@ in
"XF86MonBrightnessUp".action.spawn = ["brightnessctl" "s" "+10%"];
"XF86MonBrightnessDown".action.spawn = ["brightnessctl" "s" "10%-"];
"XF86AudioMute".action.spawn = ["pamixer" "-t"];
"Super+E".action = spawn ["${pkgs.nushell}/bin/nu" "/home/chris/bin/niriemacslof"];
"Super+E".action = spawn ["${nirilof}/bin/nirilof" "emacs" "emacsclient -c"];
"Super+Return".action.spawn = "alacritty";
"Super+B".action = spawn ["${pkgs.nushell}/bin/nu" "/home/chris/bin/nirilof" "org.qutebrowser.qutebrowser" "qutebrowser"];
"Super+B".action = spawn ["${nirilof}/bin/nirilof" "org.qutebrowser.qutebrowser" "qutebrowser"];
"Super+Alt+Space".action.spawn = "${pkgs.cosmic-launcher}/bin/cosmic-launcher";
"Super+Space".action.spawn = ["${pkgs.fish}/bin/fish" "-c" "rofi -no-lazy-grab -modi combi -show combi -combi-modi drun,run"];
"Super+Shift+W".action.spawn = ["rofi" "-i" "-show" "window"];
@ -159,7 +174,7 @@ in
{ argv = ["swww-daemon"]; }
{ argv = ["rbw-agent"]; }
{ argv = ["kdeconnect-indicator"]; }
{ argv = ["wl-paste --watch cliphist store"]; }
{ argv = ["${pkgs.wl-clipboard}/bin/wl-paste --watch cliphist store"]; }
{ argv = ["swww img /home/chris/pics/wallpapers/tech.jpg --resize crop -t grow --transition-bezier .14,0,.14,.99"]; }
{ argv = ["${reset-dbus-systemd-units}/bin/reset-dbus-systemd"]; }
];

View file

@ -1,15 +1,10 @@
#/usr/bin/env nu
def main [app: string, command: string] {
let open = try {
niri msg --json windows | from json | where app_id == $app | get id | first
} catch {
0
}
if $open > 0 {
niri msg action focus-window --id $open
} else {
let open = niri msg --json windows | from json | where app_id == $app | get id | first;
if open == null {
bash -c $"($command) &"
} else {
niri msg action focus-window --id $open
}
}