diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2023-04-15 17:25:29 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2023-04-18 22:43:32 +0300 |
commit | 4ac1ecb1c516ddd0ed35650991a0aff27523f4ab (patch) | |
tree | 93704fd79567a50413756cdf604132c5d1f5049f /dotfiles | |
parent | 3c1241eb3a4376ea01195a08d267dc91695ebab7 (diff) | |
download | swayrice-4ac1ecb1c516ddd0ed35650991a0aff27523f4ab.tar.gz swayrice-4ac1ecb1c516ddd0ed35650991a0aff27523f4ab.zip |
workspace: adapt for different screen sizes
Diffstat (limited to 'dotfiles')
-rwxr-xr-x | dotfiles/.local/bin/workspace | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/dotfiles/.local/bin/workspace b/dotfiles/.local/bin/workspace index 5183c72..749d77f 100755 --- a/dotfiles/.local/bin/workspace +++ b/dotfiles/.local/bin/workspace @@ -27,14 +27,21 @@ if [ -z "$1" ]; then exit 1 fi -swaymsg "gaps inner current set 0; gaps outer current set 0" +displayw=$(swaymsg -rt get_outputs |\ + jq --raw-output '.[] | select(.focused == true) | .rect.width') +sidebarw=30 + +if [ $displayw -lt 2560 ]; then + swaymsg "gaps inner current set 0; gaps outer current set 0" + sidebarw=27 +fi cd "$1" setsid $TERMINAL -a "$TERMINAL lf:$1" zsh -ic "lfcd" >/dev/null 2>&1 & sleep 0.1 setsid $TERMINAL -a "$TERMINAL edit:$1" >/dev/null 2>&1 & sleep 0.1 sleep 0.2 -swaymsg "[app_id=\"$TERMINAL lf:$1\"] focus; resize set width 27ppt; split v" +swaymsg "[app_id=\"$TERMINAL lf:$1\"] focus; resize set width ${sidebarw}ppt; split v" setsid $TERMINAL >/dev/null 2>&1 & sleep 0.2 swaymsg "resize set height 60ppt" && sleep 0.1 swaymsg "[app_id=\"$TERMINAL edit:$1\"] focus" |