sway stuff

This commit is contained in:
2024-06-02 20:54:00 +01:00
parent aeed8760b8
commit 5929600955
2 changed files with 74 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
#!/bin/sh
function move {
CURR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | map(select(.focused == true)) | .[0].name')
@@ -8,6 +10,7 @@ function move {
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} + 1)
;;
"prev")
[ ${CURR_WORKSPACE} -eq 1 ] && exit 0
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} - 1)
;;
esac
@@ -16,8 +19,30 @@ function move {
swaymsg "workspace ${NEW_WORKSPACE}"
}
function focus {
CURR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | map(select(.focused == true)) | .[0].name')
echo $CURR_WORKSPACE
case $1 in
"next")
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} + 1)
;;
"prev")
[ ${CURR_WORKSPACE} -eq 1 ] && exit 0
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} - 1)
;;
esac
swaymsg "workspace ${NEW_WORKSPACE}"
}
case $1 in
"move")
move $2
;;
"focus")
focus $2
;;
esac