From 4ac1ecb1c516ddd0ed35650991a0aff27523f4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Sat, 15 Apr 2023 17:25:29 +0300 Subject: workspace: adapt for different screen sizes --- dotfiles/.local/bin/workspace | 11 +++++++++-- 1 file 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" -- cgit v1.2.3