diff --git a/bin/sway_resize b/bin/sway_resize new file mode 100755 index 0000000..1d6562a --- /dev/null +++ b/bin/sway_resize @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# +# inspired by sway_move from bob hepple +# + +initialise() { + PROG=$(basename $0) + VERSION="1.0" + ARGUMENTS="top-right|bottom-right|bottom-left" + USAGE="move a floating window to the edges because sway lacks a way to do it!" + + case $1 in + -h|--help) + echo "$USAGE" + exit 0 + ;; + 1*|2*|3*|4*|5*|6*|7*|8*|9*) + command="$1" + ;; + *) + echo "$PROG: bad argument" >&2 + exit 1 + ;; + esac + + return 0 +} + +initialise "$@" +# win_dim=( $( swaymsg -t get_tree | +# jq '.. | select(.type?) | select(.type=="floating_con") | select(.focused?)|.rect.width, .rect.height, .deco_rect.height' ) ) + +type=$( swaymsg -t get_tree | jq '.. | select(.focused?)|.type' | sed 's/"//g') + +case "$type" in + "con") + if [ $1 -ge 10 -a $1 -le 90 ] + then + width=${1}ppt + echo swaymsg "resize set width ${width}" + swaymsg "resize set width ${width}" + else + echo "invalid width $1" + fi + ;; + "floating_con") + width=$((${1} * 21)) + height=$((${width} * 9 / 16)) + echo swaymsg "resize set width ${width}px height ${height}px" + swaymsg "resize set width ${width} height ${height}" + ;; + *) + echo wrong type $type + ;; +esac diff --git a/config b/config index fec58d3..a6d54f6 100644 --- a/config +++ b/config @@ -25,6 +25,7 @@ set $idle_cmd $HOME/.config/sway/bin/start_swayidle.sh set $sov_cmd $HOME/.config/sway/bin/start_sov.sh set $lock_cmd $HOME/.config/sway/bin/sway_lock lock set $move_cmd $HOME/.config/sway/bin/sway_move +set $resize_cmd $HOME/.config/sway/bin/sway_resize set $font Cascadia Code PL Regular 10 set $notify_cmd dunstify -r 123 @@ -292,16 +293,25 @@ mode "move" { # resize presets # bindsym -1 resize set width 600px height 360px # bindsym 0 resize set width 700px height 420px - bindsym 1 resize set width 800px height 480px - bindsym 2 resize set width 900px height 540px - bindsym 3 resize set width 1000px height 600px - bindsym 4 resize set width 1100px height 660px - bindsym 5 resize set width 1200px height 720px - bindsym 6 resize set width 1300px height 780px - bindsym 7 resize set width 1400px height 840px - bindsym 8 resize set width 1500px height 900px - bindsym 9 resize set width 1600px height 1040px - bindsym 0 resize set width 1700px height 1200px + # bindsym 1 resize set width 800px height 480px + # bindsym 2 resize set width 900px height 540px + # bindsym 3 resize set width 1000px height 600px + # bindsym 4 resize set width 1100px height 660px + # bindsym 5 resize set width 1200px height 720px + # bindsym 6 resize set width 1300px height 780px + # bindsym 7 resize set width 1400px height 840px + # bindsym 8 resize set width 1500px height 900px + # bindsym 9 resize set width 1600px height 1040px + # bindsym 0 resize set width 1700px height 1200px + bindsym 1 exec $resize_cmd 10 + bindsym 2 exec $resize_cmd 20 + bindsym 3 exec $resize_cmd 30 + bindsym 4 exec $resize_cmd 40 + bindsym 5 exec $resize_cmd 50 + bindsym 6 exec $resize_cmd 60 + bindsym 7 exec $resize_cmd 70 + bindsym 8 exec $resize_cmd 80 + bindsym 9 exec $resize_cmd 90 # focus bindsym $mod+h focus left bindsym $mod+j focus down @@ -350,6 +360,7 @@ for_window [app_id="pavucontrol"] floating enable for_window [app_id="com.nextcloud.desktopclient.nextcloud"] floating enable for_window [app_id="imv"] floating enable for_window [app_id="nm-openconnect-auth-dialog"] floating enable +for_window [app_id="com.obsproject.Studio"] floating enable for_window [app_id=".*"] title_format '%title (%app_id)' for_window [class=".*"] title_format '%title (%class:%instance)' # different dashes! @@ -360,6 +371,7 @@ for_window [title="bluetoothctl"] floating enable for_window [title="fzf"] floating enable # mark rules for_window [class="Plexamp" window_type="normal"] mark s +for_window [app_id="com.obsproject.Studio"] mark d for_window [class="Ferdium" window_type="normal" window_role="browser-window"] mark z for_window [class="Signal" window_type="normal" window_role="browser-window"] mark x for_window [class="Chromium" instance="crx_cifhbcnohmdccbgoicgdjpfamggdegmo" window_type="normal"] mark c diff --git a/waybar.d/config b/waybar.d/config index 9c657cf..aac4d76 100644 --- a/waybar.d/config +++ b/waybar.d/config @@ -83,9 +83,9 @@ "exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null" }, "clock": { - "format": "{:%H:%M, %b %d}", + "format": "{: %H:%M, %b %d }", "format-alt": "{:%A, %B %d, %Y (%R)}", - // "tooltip-format": "\n{calendar}", + "tooltip-format": "\n{calendar}", // "calendar": { // "mode" : "year", // "mode-mon-col" : 3, @@ -99,7 +99,7 @@ // "weekdays": "{}", // "today": "{}" // } - }, + // }, "actions": { "on-click-right": "mode", "on-click-forward": "tz_up", @@ -160,6 +160,21 @@ "tooltip-format-disconnected": "{ifname} disconnected", "on-click": "foot -T float nmtui" }, + "network#ub0": { + "interval": 2, + "interface": "ub0", + "format": "{ifname}", + "format-wifi": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname}", + "min-length": 8, + "max-length": 30, + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-ethernet": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-wifi": "{ifname} {essid} ({signalStrength:3}%)\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, "network#wl0": { "interval": 2, "interface": "wl0",