mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
niri: app maps and edit-clipboard shortcuts
This commit is contained in:
parent
bd2a7fcc26
commit
40e3834b7f
5 changed files with 149 additions and 12 deletions
|
|
@ -0,0 +1,29 @@
|
|||
# Stolen from basecamp/omarchy
|
||||
{pkgs, ...}: {
|
||||
focusOrLaunch = pkgs.writeShellApplication {
|
||||
name = "nirictl-focus-or-launch";
|
||||
|
||||
runtimeInputs = [pkgs.jq pkgs.niri];
|
||||
|
||||
text = ''
|
||||
|
||||
if (($# == 0)); then
|
||||
echo "Usage: $0 <app_id> <command-to-launch>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP_ID="$1"
|
||||
CMD="''${2:-$1}"
|
||||
|
||||
WINDOWS=$(niri msg --json windows)
|
||||
|
||||
TARGET_ID=$(echo "$WINDOWS" | jq -r ".[] | select(.app_id == \"$APP_ID\") | .id" | head -n 1)
|
||||
|
||||
if [ -n "$TARGET_ID" ]; then
|
||||
niri msg action focus-window --id "$TARGET_ID"
|
||||
else
|
||||
eval "$CMD" &
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue