You are not logged in.
Hi all,
I'm using i3. When I close the lid of my laptop with an external monitor plugged in,
the monitor of my laptop is still on by default. I want to run some code when closing
the lid so I can turn the internal monitor off and have all the work spaces on the
external monitor.
In /etc/systemd/logind.conf, a hook named "HandleLidSwitchDocked" is already there.
Can I do something with it?
Thanks,
Hs
Last edited by roghnin (2017-06-20 05:36:00)
Offline
Welcome to the arch linux forums roghnin.
In /etc/systemd/logind.conf, a hook named "HandleLidSwitchDocked" is already there.
Can I do something with it?
It is not a hook see `man 5 logind.conf`. For an alternative approach see Acpid.
Offline
Welcome to the arch linux forums roghnin.
roghnin wrote:In /etc/systemd/logind.conf, a hook named "HandleLidSwitchDocked" is already there.
Can I do something with it?It is not a hook see `man 5 logind.conf`. For an alternative approach see Acpid.
Thanks loqs.
I think i'm gonna use an individual event file for this, but I'm not sure what to put in the "event"
field -- Of course "Lid" is in it, but how to determine whether it's "Docked"? I haven't seen
anything useful with journalctl -f.
Offline
When you checked the journal this was with acpid installed and active?
Offline
When you checked the journal this was with acpid installed and active?
Yes. Acpid is active. I used systemctl status acpid to check it.
The output, when I plugged in the monitor, was:
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): EDID vendor "ACR", prod id 747
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Using hsync ranges from config file
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Using vrefresh ranges from config file
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Printing DDC gathered Modelines:
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1920x1080"x0.0 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync (67.5 kHz eP)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "800x600"x0.0 40.00 800 840 968 1056 600 601 605 628 +hsync +vsync (37.9 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "800x600"x0.0 36.00 800 824 896 1024 600 601 603 625 +hsync +vsync (35.2 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "640x480"x0.0 30.24 640 704 768 864 480 483 486 525 -hsync -vsync (35.0 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "640x480"x0.0 25.18 640 656 752 800 480 490 492 525 -hsync -vsync (31.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "720x400"x0.0 28.32 720 738 846 900 400 412 414 449 -hsync +vsync (31.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1024x768"x0.0 75.00 1024 1048 1184 1328 768 771 777 806 -hsync -vsync (56.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1024x768"x0.0 65.00 1024 1048 1184 1344 768 771 777 806 -hsync -vsync (48.4 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1152x864"x0.0 108.00 1152 1216 1344 1600 864 865 868 900 +hsync +vsync (67.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1280x1024"x0.0 108.00 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync (64.0 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1280x800"x0.0 71.00 1280 1328 1360 1440 800 803 809 823 +hsync -vsync (49.3 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1440x900"x0.0 88.75 1440 1488 1520 1600 900 903 909 926 +hsync -vsync (55.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1920x1080"x60.0 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -hsync +vsync (67.1 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1680x1050"x0.0 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync (64.7 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: [../../i3-4.13/i3bar/src/xcb.c:972] ERROR: PropertyNotify received for unknown window 00e000d8
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: [../../i3-4.13/i3bar/src/xcb.c:736] ERROR: Window 006004bd violates the XEMBED protocol, _XEMBED_INFO not setJun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): EDID vendor "ACR", prod id 747
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Using hsync ranges from config file
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Using vrefresh ranges from config file
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Printing DDC gathered Modelines:
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1920x1080"x0.0 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync (67.5 kHz eP)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "800x600"x0.0 40.00 800 840 968 1056 600 601 605 628 +hsync +vsync (37.9 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "800x600"x0.0 36.00 800 824 896 1024 600 601 603 625 +hsync +vsync (35.2 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "640x480"x0.0 30.24 640 704 768 864 480 483 486 525 -hsync -vsync (35.0 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "640x480"x0.0 25.18 640 656 752 800 480 490 492 525 -hsync -vsync (31.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "720x400"x0.0 28.32 720 738 846 900 400 412 414 449 -hsync +vsync (31.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1024x768"x0.0 75.00 1024 1048 1184 1328 768 771 777 806 -hsync -vsync (56.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1024x768"x0.0 65.00 1024 1048 1184 1344 768 771 777 806 -hsync -vsync (48.4 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1152x864"x0.0 108.00 1152 1216 1344 1600 864 865 868 900 +hsync +vsync (67.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1280x1024"x0.0 108.00 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync (64.0 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1280x800"x0.0 71.00 1280 1328 1360 1440 800 803 809 823 +hsync -vsync (49.3 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1440x900"x0.0 88.75 1440 1488 1520 1600 900 903 909 926 +hsync -vsync (55.5 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1920x1080"x60.0 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -hsync +vsync (67.1 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: (II) intel(0): Modeline "1680x1050"x0.0 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync (64.7 kHz e)
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: [../../i3-4.13/i3bar/src/xcb.c:972] ERROR: PropertyNotify received for unknown window 00e000d8
Jun 17 21:21:22 Arch-X1C /usr/lib/gdm/gdm-x-session[728]: [../../i3-4.13/i3bar/src/xcb.c:736] ERROR: Window 006004bd violates the XEMBED protocol, _XEMBED_INFO not set
Offline
Marked it solved.
I chose to add shell code in /etc/acpi/handler.sh. I used my own shell code calling xrandr to judge whether it's docked or not. Didn't find any easier ways.
BTW, if you want to call xrandr in those shell codes in acpi, remember to export DISPLAY and XAUTHORITY at the top of your *.sh first, like:
#!/bin/bash
export DISPLAY=:1
export XAUTHORITY=/run/user/1000/gdm/Xauthority
Something like that.
Hs
Offline
When running "acpi_listen" and closing the lid you should get an (or rather two) event line which you can use for the acpi handler script. It's parameters should indicate whether the lid closed or opened.
If you rely on xrandr, something else™ would already have intercepted and deactivated the internal screen, yesno?
Offline