update biri on laptop, link biri-related scripts to its config

This commit is contained in:
greyweather committed 2026-09-04 13:24:16 +01:00
1 parent 41c967538a
commit 257654332d
5 files changed
+70 -34

No files matched your search

@@ -36,5 +36,53 @@
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/niri.kdl";
});
};
features.applications.shellScripts = {
niri-scratch-workspace-toggle = ''
if niri msg --json workspaces-with-hidden | jq -e '.[] | select(.name=="x") | .is_hidden' >/dev/null; then
niri msg action unhide-workspace --focus=false "x"
OUTPUT=$(niri msg --json focused-output | jq '.name' | sed 's/"//g')
niri msg action move-workspace-to-monitor --reference "x" "$OUTPUT"
niri msg action focus-workspace "x"
else
niri msg action hide-workspace "x"
fi
'';
niri-listen-for-scratch-workspace-change = ''
niri msg --json event-stream | while read -r event; do
if echo $event | jq -e '.WorkspaceActivated.focused' >/dev/null; then
if niri msg --json workspaces | jq -e '.[] | select(.name=="x") | .is_active==false' >/dev/null; then
niri msg action hide-workspace "x"
fi
elif echo $event | jq -e '.WorkspacesChanged.workspaces.[] | select(.name=="x") | .is_active==false' >/dev/null; then
niri msg action hide-workspace "x"
fi
done
'';
niri-toggle-dwt = ''
niri msg action toggle-dwt
cd ${config.xdg.stateHome}
if [ -f ./niri.json ]; then
if jq -e '.dwt' niri.json >/dev/null; then
NEW_JSON=$(jq '.dwt = false' niri.json)
echo "$NEW_JSON" > niri.json
else
NEW_JSON=$(jq '.dwt = true' niri.json)
echo "$NEW_JSON" > niri.json
fi
else
echo '{"dwt": false}' | jq '.' > niri.json
fi
NEW_STATE=$(jq '.dwt' niri.json)
noctalia msg notification-show "Touchpad DWT toggled $NEW_STATE"
'';
niri-clear-state = ''
cd ${config.xdg.stateHome}
rm niri.json
'';
};
};
}