From b1bd84b4958054a4e9560c8ba5fb8f202ef47b23 Mon Sep 17 00:00:00 2001 From: Jonas H Date: Fri, 19 Jun 2026 10:45:19 +0200 Subject: [PATCH] sway smart hdmi and signal --- sway/.config/sway/config | 1 + sway/.config/sway/monitors | 4 ++-- sway/.config/sway/scripts/hdmi-setup.sh | 23 +++++++++++++++++++++++ sway/.config/sway/windowrules | 3 +++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 sway/.config/sway/scripts/hdmi-setup.sh diff --git a/sway/.config/sway/config b/sway/.config/sway/config index a9ddd9c..5dbedb8 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -5,6 +5,7 @@ exec_always eww daemon && (eww open bar0 || true) && (eww open bar1 || true) exec_always mako exec /usr/libexec/polkit-mate-authentication-agent-1 +exec flatpak run org.signal.Signal exec swayidle -w \ timeout 900 '~/.local/bin/smart-dim.sh' \ diff --git a/sway/.config/sway/monitors b/sway/.config/sway/monitors index 90656ad..ed738a1 100644 --- a/sway/.config/sway/monitors +++ b/sway/.config/sway/monitors @@ -5,9 +5,9 @@ set $res_y 1890 set $resolution 3024x1890 set $scale 1.5 -output eDP-1 resolution $resolution position 0,1445 scale $scale +output eDP-1 resolution $resolution scale $scale -output HDMI-A-1 position 0,0 scale 1.5 +exec_always ~/.config/sway/scripts/hdmi-setup.sh output DVI-I-2 position -2560,0 scale 1.5 output DVI-I-1 position -5120,0 scale 1.5 diff --git a/sway/.config/sway/scripts/hdmi-setup.sh b/sway/.config/sway/scripts/hdmi-setup.sh new file mode 100755 index 0000000..c4ac236 --- /dev/null +++ b/sway/.config/sway/scripts/hdmi-setup.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +OUTPUTS=$(swaymsg -t get_outputs) +HDMI_CONNECTED=$(echo "$OUTPUTS" | jq '[.[] | select(.name == "HDMI-A-1")] | length > 0') + +if [ "$HDMI_CONNECTED" = "true" ]; then + IS_4K=$(echo "$OUTPUTS" | jq '[.[] | select(.name == "HDMI-A-1") | .modes[].width] | max >= 3840') + + if [ "$IS_4K" = "true" ]; then + RES_H=2160 + SCALE=1.5 + swaymsg output HDMI-A-1 resolution 3840x2160 scale $SCALE pos 0 0 + else + RES_H=1440 + SCALE=1.0 + swaymsg output HDMI-A-1 resolution 2560x1440 scale $SCALE pos 0 0 + fi + + HDMI_LOGICAL_H=$(echo "$RES_H / $SCALE" | bc) + swaymsg output eDP-1 resolution 3024x1890 scale 1.5 pos 0 $HDMI_LOGICAL_H +else + swaymsg output eDP-1 resolution 3024x1890 scale 1.5 pos 0 0 +fi diff --git a/sway/.config/sway/windowrules b/sway/.config/sway/windowrules index 2ac4ddf..18338bf 100644 --- a/sway/.config/sway/windowrules +++ b/sway/.config/sway/windowrules @@ -1,3 +1,4 @@ +for_window [app_id="signal"] move to scratchpad for_window [app_id="hooknloop"] floating enable for_window [app_id="lego-build"] floating enable for_window [instance="LEGO_Brain"] floating enable @@ -7,3 +8,5 @@ for_window [instance="sameboy"] floating enable for_window [class="feh"] floating enable for_window [app_id="mpv"] floating enable for_window [class="snow_trail_sdl"] floating enable +for_window [app_id="destinations"] floating enable +for_window [class="destinations"] floating enable