Add hotkeys for apps

This commit is contained in:
2026-07-03 13:53:07 +02:00
parent 772c26f0b1
commit 4f6643fd8e
5 changed files with 97 additions and 3 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ input {
}
touchpad {
//tap // Enable tap-to-click
tap // Enable tap-to-click
dwt
scroll-method "two-finger"
tap-button-map "left-right-middle"
+4 -1
View File
@@ -13,8 +13,12 @@ binds {
// ─── Applications ───
Alt+Return hotkey-overlay-title="Open Terminal: Alacritty" { spawn "alacritty"; }
Mod+G hotkey-overlay-title="Focus: Gmail" { spawn-sh "$HOME/.config/niri/focus-or-launch.sh chrome-fmgjjmmmlfnkbppncabfkddbjimcfncm-Default /opt/helium-browser-bin/helium-wrapper --profile-directory=Default --app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm"; }
Mod+W hotkey-overlay-title="Focus: WhatsApp" { spawn-sh "$HOME/.config/niri/focus-or-launch.sh chrome-hnpfjngllnobngcgfapefoaidbinmjnm-Default /opt/helium-browser-bin/helium-wrapper --profile-directory=Default --app-id=hnpfjngllnobngcgfapefoaidbinmjnm"; }
Mod+D hotkey-overlay-title="Focus: Todoist" { spawn-sh "$HOME/.config/niri/focus-or-launch.sh chrome-dlgohinmglaoopaiplliaecdpmnepmga-Default /opt/helium-browser-bin/helium-wrapper --profile-directory=Default --app-id=dlgohinmglaoopaiplliaecdpmnepmga"; }
//Mod+CTRL+Return hotkey-overlay-title="Open App Launcher: noctalia launcher" { spawn-sh "qs -c noctalia-shell ipc call launcher toggle"; }
Alt+Space hotkey-overlay-title="Open App Launcher: noctalia launcher" { spawn-sh "qs -c noctalia-shell ipc call launcher toggle"; }
Alt+Shift+Space hotkey-overlay-title="Open Window Search: noctalia launcher" { spawn-sh "qs -c noctalia-shell ipc call launcher windows"; }
Mod+B hotkey-overlay-title="Open Browser: helium" { spawn "helium-browser"; }
Mod+L hotkey-overlay-title="Lock Screen: noctalia lock" { spawn-sh "qs -c noctalia-shell ipc call lockScreen lock"; }
Mod+Shift+Q hotkey-overlay-title="Session Menu: noctalia sessionMenu" { spawn-sh "qs -c noctalia-shell ipc call sessionMenu toggle"; }
@@ -132,7 +136,6 @@ binds {
// ─── Modes ───
Mod+T { toggle-window-floating; }
Mod+F { fullscreen-window; }
Mod+W { toggle-column-tabbed-display; }
// ─── Screenshots ───
CTRL+Shift+1 { screenshot; }
+3 -1
View File
@@ -5,7 +5,9 @@
background-color "transparent" // <- needed for noctalia-shell to set wallpaper
//default-column-width { proportion 0.95; }
default-column-width { proportion 0.40; }
//default-column-width { proportion 0.40; }
//default-column-width {}
default-column-width { fixed 1200; }
preset-column-widths {
proportion 0.33333
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Focus an existing window by app-id, or launch it if not found.
# If the target window is already focused, return to the previous window.
# Usage: focus-or-launch.sh <app-id> <launch-command...>
APP_ID="$1"
shift
WINDOWS=$(niri msg -j windows)
FOCUSED_ID=$(echo "$WINDOWS" | jq -r '.[] | select(.is_focused == true) | .id')
TARGET_ID=$(echo "$WINDOWS" | jq -r --arg app "$APP_ID" '.[] | select(.app_id == $app) | .id' | head -1)
PREV_FILE="/tmp/niri-focus-prev-${APP_ID}"
if [ "$FOCUSED_ID" = "$TARGET_ID" ]; then
if [ -f "$PREV_FILE" ]; then
niri msg action focus-window --id "$(cat "$PREV_FILE")" 2>/dev/null || true
fi
else
echo "$FOCUSED_ID" > "$PREV_FILE"
if [ -n "$TARGET_ID" ]; then
niri msg action focus-window --id "$TARGET_ID"
else
exec "$@"
fi
fi