Having issues with the display manager in garuda sway

Hey everyone,

I have recently installed garuda sway for a minimial and power efficient desktop. I have been learning and tweaking this for almost 3 days now and I am having too many issues that I feel I should go back to arch linux with hyprland. However i dont wanna lose hope and community seems to be my last hope. I will post my other issues in further posts. For now, the display issue…

For some reason, the display manager isn’t saving the configuration after reboot. I set the resolution of my laptop display to be 1680x1050 (because everything seems too tiny) and after reboot, it resets back to 2240x1400.

And also another question. I would like to have my configuration such that when i connect my laptop to a hdmi monitor, my main laptop display turns off and my hdmi monitor is the main display now and when i disconnect the hdmi, the laptop display turns back to normal. I have tried many things (including writing .sh file thru chatgpt and adding it in .config/sway/scripts and calling the script in autostart-applications file). Each time i refine it, it would break something else.
Is there any solution for these? (I have tried searching abt this in forum and didnt find anything)

Thanks in advance!

System:
  Kernel: 6.14.1-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
    clocksource: hpet avail: acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=f7a1bd70-67e6-43b9-9ba8-616f8ef92b8d rw rootflags=subvol=@
    quiet loglevel=3 hush ibt=off
  Desktop: Sway v: 0.5 with: waybar tools: swayidle avail: gtklock vt: 1
    lm: greetd Distro: Garuda base: Arch Linux
Machine:
  Type: Convertible System: LENOVO product: 82XX v: IdeaPad Flex 5 14ABR8
    serial: <superuser required> Chassis: type: 31 v: IdeaPad Flex 5 14ABR8
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0T76463 WIN
    serial: <superuser required> part-nu: LENOVO_MT_82XX_BU_idea_FM_IdeaPad
    Flex 5 14ABR8 uuid: <superuser required> UEFI: LENOVO v: L7CN23WW
    date: 09/10/2024
Battery:
  ID-1: BAT0 charge: 42.3 Wh (79.1%) condition: 53.5/52.5 Wh (102.0%)
    power: 10.8 W volts: 12.1 min: 11.5 model: LGES L21L3PE0 type: Li-poly
    serial: <filter> status: discharging cycles: 560
CPU:
  Info: model: AMD Ryzen 7 7730U with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 3 gen: 3 level: v3 note: check built: 2021-22
    process: TSMC n7 (7nm) family: 0x19 (25) model-id: 0x50 (80) stepping: 0
    microcode: 0xA500011
  Topology: cpus: 1x dies: 1 clusters: 1 cores: 8 threads: 16 tpc: 2
    smt: enabled cache: L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB
    desc: 8x512 KiB L3: 16 MiB desc: 1x16 MiB
  Speed (MHz): avg: 400 min/max: 400/2000 boost: disabled scaling:
    driver: amd-pstate-epp governor: powersave cores: 1: 400 2: 400 3: 400
    4: 400 5: 400 6: 400 7: 400 8: 400 9: 400 10: 400 11: 400 12: 400 13: 400
    14: 400 15: 400 16: 400 bogomips: 63877
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities: <filter>
Graphics:
  Device-1: Advanced Micro Devices [AMD/ATI] Barcelo vendor: Lenovo
    driver: amdgpu v: kernel arch: GCN-5 code: Vega process: GF 14nm
    built: 2017-20 pcie: gen: 3 speed: 8 GT/s lanes: 16 ports:
    active: HDMI-A-1,eDP-1 empty: DP-1 bus-ID: 04:00.0 chip-ID: 1002:15e7
    class-ID: 0300 temp: 42.0 C
  Device-2: Luxvisions Innotech Integrated Camera driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:3 chip-ID: 30c9:0053
    class-ID: fe01 serial: <filter>
  Display: wayland server: Xwayland v: 24.1.6 compositor: Sway v: 0.5
    driver: gpu: amdgpu d-rect: 3360x1050 display-ID: 1
  Monitor-1: HDMI-A-1 pos: primary,left model: Acer V223W serial: <filter>
    built: 2008 res: mode: 1680x1050 hz: 60 scale: 100% (1) dpi: 90 gamma: 1.2
    size: 474x296mm (18.66x11.65") diag: 559mm (22") ratio: 16:10 modes:
    max: 1680x1050 min: 720x400
  Monitor-2: eDP-1 pos: right model: Lenovo 0x89bc built: 2020 res:
    mode: 1680x1050 hz: 60 scale: 100% (1) dpi: 190 gamma: 1.2
    size: 300x188mm (11.81x7.4") diag: 354mm (13.9") ratio: 16:10 modes:
    max: 2240x1400 min: 640x480
  API: Vulkan v: 1.4.309 layers: 5 device: 0 type: integrated-gpu name: AMD
    Radeon Graphics (RADV RENOIR) driver: N/A device-ID: 1002:15e7
    surfaces: xcb,xlib,wayland device: 1 type: cpu name: llvmpipe (LLVM
    19.1.7 256 bits) driver: N/A device-ID: 10005:0000
    surfaces: xcb,xlib,wayland
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
  Info: Tools: api: vulkaninfo wl: kanshi, swaymsg, wdisplays, wlr-randr
    x11: xprop
Audio:
  Device-1: Advanced Micro Devices [AMD/ATI] Renoir Radeon High Definition
    Audio vendor: Lenovo driver: snd_hda_intel v: kernel pcie: gen: 3
    speed: 8 GT/s lanes: 16 bus-ID: 04:00.1 chip-ID: 1002:1637 class-ID: 0403
  Device-2: Advanced Micro Devices [AMD] ACP/ACP3X/ACP6x Audio Coprocessor
    vendor: Lenovo driver: N/A alternate: snd_pci_acp3x, snd_rn_pci_acp3x,
    snd_pci_acp5x, snd_pci_acp6x, snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps,
    snd_sof_amd_renoir, snd_sof_amd_rembrandt, snd_sof_amd_vangogh,
    snd_sof_amd_acp63, snd_sof_amd_acp70 pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 04:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-3: Advanced Micro Devices [AMD] Family 17h/19h/1ah HD Audio
    vendor: Lenovo driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s
    lanes: 16 bus-ID: 04:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.14.1-zen1-1-zen status: kernel-api
    tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.4.1 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8852BE PCIe 802.11ax Wireless Network vendor: Lenovo
    driver: rtw89_8852be v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: 2000 bus-ID: 02:00.0 chip-ID: 10ec:b852 class-ID: 0280
  IF: wlp2s0 state: up mac: <filter>
  Info: services: NetworkManager, systemd-timesyncd, wpa_supplicant
Bluetooth:
  Device-1: Realtek Bluetooth Radio driver: btusb v: 0.8 type: USB rev: 1.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 3-4:3 chip-ID: 0bda:4853
    class-ID: e001 serial: <filter>
  Report: btmgmt ID: hci0 rfk-id: 5 state: up address: <filter> bt-v: 5.2
    lmp-v: 11 status: discoverable: no pairing: no class-ID: 6c0000
Drives:
  Local Storage: total: 953.87 GiB used: 10.11 GiB (1.1%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
    model: MZAL41T0HBLB-00BL2 size: 953.87 GiB block-size: physical: 512 B
    logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 7L1QHXC7 temp: 36.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 147.43 GiB size: 147.43 GiB (100.00%)
    used: 10.11 GiB (6.9%) fs: btrfs dev: /dev/nvme0n1p8 maj-min: 259:8
  ID-2: /boot/efi raw-size: 1 GiB size: 1 GiB (99.80%) used: 608 KiB (0.1%)
    fs: vfat dev: /dev/nvme0n1p7 maj-min: 259:7
  ID-3: /home raw-size: 147.43 GiB size: 147.43 GiB (100.00%)
    used: 10.11 GiB (6.9%) fs: btrfs dev: /dev/nvme0n1p8 maj-min: 259:8
  ID-4: /var/log raw-size: 147.43 GiB size: 147.43 GiB (100.00%)
    used: 10.11 GiB (6.9%) fs: btrfs dev: /dev/nvme0n1p8 maj-min: 259:8
  ID-5: /var/tmp raw-size: 147.43 GiB size: 147.43 GiB (100.00%)
    used: 10.11 GiB (6.9%) fs: btrfs dev: /dev/nvme0n1p8 maj-min: 259:8
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 14.97 GiB used: 0 KiB (0.0%) priority: 100
    comp: zstd avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 max-streams: 16
    dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 43.9 C mobo: N/A gpu: amdgpu temp: 42.0 C
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 16 GiB note: est. available: 14.97 GiB used: 4.61 GiB (30.8%)
  Processes: 378 Power: uptime: 3h 35m states: freeze,mem,disk
    suspend: s2idle wakeups: 2 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 5.98 GiB services: upowerd Init: systemd
    v: 257 default: graphical tool: systemctl
  Packages: pm: pacman pkgs: 1171 libs: 358 tools: pacseek,paru Compilers:
    gcc: 14.2.1 Shell: garuda-inxi default: fish v: 4.0.1 running-in: foot
    inxi: 3.3.37
Garuda (2.7.2-1):
  System install date:     2025-04-09
  Last full system update: 2025-04-09
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       Probably (Run as root to verify)
  Failed units:            

Hi there, welcome to the forum.
Please always include your garuda-inxi output, as required in the topic template.
As far as the issue is concerned, I’m not a Sway user.
Just giving a look at the default configuration, I see all the relevant files in $HOME/.config/sway/config.d/ seem to point to $HOME/.config/sway/scripts/hidpi_1.5.sh which is probably the one you need to disable and change $HOME/.config/sway/config.d/output.

But I’m sure Sway people will help better soon :slight_smile:

3 Likes

Thanks for mentioning. I have done it in the post. Is that what you mean?

No, actually the entire output of:

garuda-inxi

Done! Is this okay?

Yep. :slight_smile:

It is possible this is a misunderstanding. The display manager handles login and session initiation, and confusingly has nothing to do with configuring your displays at all.

What was your method for configuring this change? Are you editing ~/.config/sway/config.d/output, or something else? Paste the config you have edited here into the thread so we can see what is happening.

That should work well for this. Let’s see the script; maybe we can help you get it straightened out.

Paste also the output of swaymsg -t get_outputs so we can see the displays you are dealing with.

Quite the detective! :detective: That’s exactly right, the config in ~/.config/sway/config.d/output should be edited to remove or comment out the call to hidpi_1.5.sh, to be replaced with an appropriate display config as suggested in the config comments. In this case, the call to hidpi_1.5.sh can be replaced with the custom display script (or it can be left in autostart_applications; either way should work fine).

Note that no matter where the custom display script is, it should be an exec_always type so that the script is re-run when the Sway config is reloaded.

exec_always ~/.config/sway/scripts/my_cool_custom_display_script
4 Likes
#!/bin/bash
# hdmi_auto_switch.sh
RESOLUTION="1680x1050"
HDMI_OUTPUT="HDMI-A-1"   # Adjust this to your actual HDMI output name
LAPTOP_OUTPUT="eDP-1"    # Adjust to your laptop's output name

# Log file for debugging
LOGFILE="/tmp/hdmi_auto_switch.log"
echo "$(date): Script started." >> "$LOGFILE"

# Get output status in JSON for more reliable parsing
OUTPUTS_JSON=$(swaymsg -t get_outputs --raw)
if echo "$OUTPUTS_JSON" | grep -q "\"name\":\"$HDMI_OUTPUT\""; then
    # Check if HDMI is active
    if echo "$OUTPUTS_JSON" | grep -A 20 "\"name\":\"$HDMI_OUTPUT\"" | grep -q "\"active\": true"; then
        echo "$(date): HDMI is active." >> "$LOGFILE"
        swaymsg output "$LAPTOP_OUTPUT" disable
        swaymsg output "$HDMI_OUTPUT" enable mode "$RESOLUTION" position 0 0
        echo "$(date): Enabled HDMI and disabled laptop display." >> "$LOGFILE"
    else
        echo "$(date): HDMI is inactive." >> "$LOGFILE"
        swaymsg output "$HDMI_OUTPUT" disable
        swaymsg output "$LAPTOP_OUTPUT" enable mode "$RESOLUTION" position 0 0
        echo "$(date): Disabled HDMI and re-enabled laptop display." >> "$LOGFILE"
    fi
else
    echo "$(date): HDMI output '$HDMI_OUTPUT' not found." >> "$LOGFILE"
fi

This is the script i got after tinkering with chatgpt (i dont have much experience with shell scripting). However everything seems to be right.

This is the outputs sections

Output HDMI-A-1 'Acer Technologies V223W LBQ0C0364043' (focused)
  Current mode: 1680x1050 @ 59.954 Hz
  Power: on
  Position: 0,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 3
  Max render time: off
  Adaptive sync: disabled
  Allow tearing: no
  Available modes:
    1680x1050 @ 59.954 Hz
    1920x1080 @ 60.000 Hz (16:9)
    1920x1080 @ 59.940 Hz (16:9)
    1600x1200 @ 60.000 Hz
    1400x1050 @ 59.948 Hz
    1280x1024 @ 75.025 Hz
    1440x900 @ 74.984 Hz
    1440x900 @ 59.901 Hz
    1280x960 @ 60.000 Hz
    1280x800 @ 59.910 Hz
    1152x864 @ 75.000 Hz
    1280x720 @ 60.000 Hz (16:9)
    1280x720 @ 59.940 Hz (16:9)
    1024x768 @ 75.029 Hz
    1024x768 @ 70.069 Hz
    1024x768 @ 60.004 Hz
    832x624 @ 74.551 Hz
    800x600 @ 75.000 Hz
    800x600 @ 72.188 Hz
    800x600 @ 60.317 Hz
    800x600 @ 56.250 Hz
    720x480 @ 60.000 Hz (4:3)
    720x480 @ 60.000 Hz (16:9)
    720x480 @ 59.940 Hz
    720x480 @ 59.940 Hz (16:9)
    640x480 @ 75.000 Hz
    640x480 @ 72.809 Hz
    640x480 @ 66.667 Hz
    640x480 @ 60.000 Hz (4:3)
    640x480 @ 59.940 Hz
    720x400 @ 70.082 Hz

Output eDP-1 'Lenovo Group Limited 0x89BC Unknown'
  Current mode: 1680x1050 @ 60.021 Hz
  Power: on
  Position: 1680,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2
  Max render time: off
  Adaptive sync: disabled
  Allow tearing: no
  Available modes:
    2240x1400 @ 60.021 Hz
    1920x1200 @ 60.021 Hz
    1920x1080 @ 60.021 Hz
    1600x1200 @ 60.021 Hz
    1680x1050 @ 60.021 Hz
    1280x1024 @ 60.021 Hz
    1440x900 @ 60.021 Hz
    1280x800 @ 60.021 Hz
    1280x720 @ 60.021 Hz
    1024x768 @ 60.021 Hz
    800x600 @ 60.021 Hz
    640x480 @ 60.021 Hz

The variable names seem to be right.

As @filo mentioned, i have already noticed this and commented the script calling in output and instead call my own shell script. (Commented for now as it doesnt work)

So basically i have almost tried everything that you suggested ig.

The script seems very complicated for what you are trying to do, but probably could be made to work if you straighten out a couple issues.

This is going to need a space after the colon, or it will not match the json output. It should be like this:

"\"name\": \"$HDMI_OUTPUT\""

Also, grep -A 20 might not be going deep enough to capture the "active" line. Here is what I see on my computer with grep -A 20:

❯ swaymsg -t get_outputs --raw | grep -A 20 "\"name\": \"eDP-1\""
    "name": "eDP-1",
    "window": null,
    "nodes": [],
    "floating_nodes": [],
    "focus": [
      4
    ],
    "fullscreen_mode": 0,
    "sticky": false,
    "floating": null,
    "scratchpad_state": null,
    "primary": false,
    "make": "BOE",
    "model": "0x095F",
    "serial": "Unknown",
    "modes": [
      {
        "width": 2256,
        "height": 1504,
        "refresh": 59999,
        "picture_aspect_ratio": "none"

If I bump it up to grep -A 30 I get the "active" output on the very last line.

❯ swaymsg -t get_outputs --raw | grep -A 30 "\"name\": \"eDP-1\""
    "name": "eDP-1",
    "window": null,
    "nodes": [],
    "floating_nodes": [],
    "focus": [
      4
    ],
    "fullscreen_mode": 0,
    "sticky": false,
    "floating": null,
    "scratchpad_state": null,
    "primary": false,
    "make": "BOE",
    "model": "0x095F",
    "serial": "Unknown",
    "modes": [
      {
        "width": 2256,
        "height": 1504,
        "refresh": 59999,
        "picture_aspect_ratio": "none"
      },
      {
        "width": 2256,
        "height": 1504,
        "refresh": 47998,
        "picture_aspect_ratio": "none"
      }
    ],
    "non_desktop": false,
    "active": true,

Try fixing those two issues and then test again.

But probably the script could be made a lot simpler if you want. For example, something like this should work just as well:

#!/bin/bash

# Check if the HDMI display is connected
if swaymsg -t get_outputs | grep -q 'LBQ0C0364043'; then
    # If it is, disable the laptop display
    swaymsg output eDP-1 disable
    # Set the resolution and position
    swaymsg output HDMI-A-1 enable mode 1680x1050 position 0 0
else
    # If the HDMI display is not connected, set the resolution and position on the laptop display
    swaymsg output eDP-1 enable mode 1680x1050 position 0 0
fi
6 Likes

Yes I know it is quite complicated. The reason for that was because of tuning chatgpt’s answers repeatedly to an extent that it went this far.
Initially i had put up the script as simple as yours. But the issue was, if i disconnect my hdmi, the laptop display doesn’t turn back to its normal state because of which i see a black blank screen. Hence i had to all kinds of stunts to finally accept my defeat.

I tried out your script and have the same issue again. The laptop display doesn’t turn back to its normal state after disconnecting hdmi

hi im not a pro even not on sway. Im actually on Hypr but my script looks near like @BluishHumility

if you want give it a try:

if xrandr | grep "HDMI-A-1 connected"; then
    swaymsg output eDP-1 disable
    swaymsg output HDMI-A-1 enable
    swaymsg output HDMI-A-1 resolution 1680x1050
else
    swaymsg output HDMI-A-1 disable
    swaymsg output eDP-1 enable
    swaymsg output eDP-1 resolution 1680x1050
fi

or try to add those position 0 0 too.

good luck :wink:

After you disconnect the HDMI cable, reload your Sway config.

Mod+Shift+C

Every time you reload the Sway config, the script will run again since it is in the config as exec_always.

If you want to reload the display configuration automatically when you plug or unplug the HDMI cable (without pressing the keybinding), set up a udev rule for the HDMI plug/unplug event and have it run your display script. udev - ArchWiki

6 Likes

Yes looks like i need to get used to using the shortcut for reloading the config. udev doesnt seem to work for me right now but i am sure i will figure it out in some time.

Thank you everyone!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.