ReGreet icon indicating copy to clipboard operation
ReGreet copied to clipboard

I have multi-monitors, and I want to set the output of ReGreet to the middle one.

Open aspauldingcode opened this issue 1 year ago • 10 comments

I tried editing a custom sway-config under the recommended location /etc/greetd/sway-config and I was unsuccessful in setting the outputs config, so I thought I would disable left/right screens using video="DP-1:d" video="DP-3:d" under systemd boot kernel params.

However, I couldn't figure out how to re-enable those displays, which would be nice too for a temp work-around.

I use sway, greetd and ReGreet. Currently ReGreet shows on my left monitor only, which is portrait and it shows sideways. Super difficult.

aspauldingcode avatar Aug 04 '24 02:08 aspauldingcode

PS I'm using nixos

aspauldingcode avatar Aug 04 '24 02:08 aspauldingcode

Could you instead change the Sway config instead of the systemd boot kernel params? Because ReGreet is just a simple GTK app. The only multi-monitor support it has it to choose the first monitor, and adding full monitor configuration would be too complicated for a simple GTK app.

rharish101 avatar Aug 04 '24 09:08 rharish101

Could you instead change the Sway config instead of the systemd boot kernel params? Because ReGreet is just a simple GTK app. The only multi-monitor support it has it to choose the first monitor, and adding full monitor configuration would be too complicated for a simple GTK app.

Well, I would say I've already tried that;

https://github.com/aspauldingcode/.dotfiles/blob/main/system/NIXSTATION64/greetd/sway-config

I have commented out my attempt

aspauldingcode avatar Aug 06 '24 13:08 aspauldingcode

Can you try these lines:

output DP-4 disable
output DP-6 disable

Note that there are no quotes around DP-4 and DP-6.

Further, are you sure that your monitors are called DP-4 and DP-6, and not DP-1 and DP-3 (or something else)? The manpage says that you can use swaymsg -t get_outputs to confirm the exact names (including any hyphens and so on).

rharish101 avatar Aug 07 '24 08:08 rharish101

I don't think that worked, but maybe it's fixable.

What I really want is to disable based on monitor name.

So I could do like "asus 24in something model number" and it would select that.

The problems I am facing are probably not regreet related, but I might need more help on this.

For context:

Sometimes, at reboot, the outputs rename themselves. Also, sometimes after a reboot, the monitor names are blank. I'm not sure why. I use a Tesmart hardware KVM. Maybe it's the issue? It takes in hdmi only. All my GPUs have DP out. So I use these cables that might be too long. They are dp to hdmi. I use 6 of them. 3 for GPU 1, 3 for GPU 2. I only ise one GPU fir linux, the other is meant to be passthrough ovmf for a virtual machine. I am away from my computer for about a month, but I would still like to troubleshoot this when I get my desktop.

Thanks for helping!

aspauldingcode avatar Aug 24 '24 15:08 aspauldingcode

i was able to get this working by adding the correct lines in my sway-config file, as outlined above. i was using the DP-2 and HDMI-A-1 names.

according to man 5 sway-output, it does say that it allows "names":

Some outputs may have different names when disconnecting and reconnecting. To identify these, the name can be substituted for a string consisting of the make, model and serial which you can get from swaymsg -t get_outputs. Each value must be separated by one space. For example:

output "Some Company ABC123 0x00000000" pos 1920 0

not sure if that helps or not if it's something you've already tried?

smorks avatar Sep 19 '24 14:09 smorks

I'm also trying to do this. My sway config has the three monitors, left one at pos -1920,0, middle one at pos 0,0, right one at pos 1920,0

I have the middle monitor as workspace 1, and as the first workspace added. left as 2 and right as 3

Even with all this setup, the application starts on the left monitor. My final attempt was to move it to the middle one using for_window [all] move window to workspace 1 and this still didn't work.

Noodlez1232 avatar Jan 10 '25 22:01 Noodlez1232

Why not just disable the other two monitors in the Sway config?

rharish101 avatar Jan 10 '25 23:01 rharish101

Although this works, this is unsightly because KMS will init all 3 monitors (for the pre-boot console) and Plymouth as well, then it gets shut off for ReGreet, then enabled again by KDE or whatever DE you start.

Noodlez1232 avatar Jan 15 '25 00:01 Noodlez1232

The most elegant solution I could put together (that didn't require any screen disabling) was using an external script to move the regreet window to the right display as soon as it appears, here it is for reference :

#!/bin/bash
regreet & p=$!
# wait for regreet window to actually appear, then get focus
swaymsg -t subscribe '["window"]'
get_focused() {
    swaymsg -t get_tree | jq -r '.. | select(.focused? and .app_id=="apps.regreet")'
}
cur_focused=$(get_focused)
while [[ -z $cur_focused ]]; do
    cur_focused=$(get_focused)
done
swaymsg 'move output DP-1'
swaymsg '[app_id="apps.regreet"] focus'
# and wait for regreet's end
wait $p
swaymsg exit

Unfortunately, sway events don't seem to have enough granularity for them to be used to detect when a new window actually appears on screen (i.e. is focused) so this while loop is what it takes for it to work.

kStor2poche avatar Mar 19 '25 11:03 kStor2poche