49 lines
867 B
Bash
Executable File
49 lines
867 B
Bash
Executable File
#!/bin/sh
|
|
|
|
function move {
|
|
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 "move container to workspace ${NEW_WORKSPACE}"
|
|
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
|