Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

move taskbar to secondary monitor when lid closed?

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
mark4
Apprentice
Apprentice
Posts: 219
Joined: Sat Feb 26, 2011 2:34 pm

move taskbar to secondary monitor when lid closed?

  • Quote

Post by mark4 » Tue Jul 15, 2025 1:13 am

I am using cinnamon desktop and would like to have my task bar move to the secondary monitor (if there is one) when the laptop lid is closed. This does not seem to be an option, the only options listed are

suspend
shut down immediately
hibernate
lock screen
do nothing

I would like for the laptop monitor to be turned off and the task bar to be moved to the secondary screen. How can this be done?
Top
wildhorse
Apprentice
Apprentice
User avatar
Posts: 185
Joined: Thu Mar 16, 2006 3:59 am
Location: Estados Unidos De América

  • Quote

Post by wildhorse » Wed Jul 16, 2025 8:50 am

Check if the lid switch triggers an ACPI event. There should be an entry called something like "lid" in /proc/acpi/. You can add your own event handler to /etc/acpi/, provided you have sys-power/acpid installed.

Code: Select all

find /proc/acpi/ -name \*lid\*
Unhandled ACPI events end up entry in the system log (typically /var/log/messages).

A little tool called x11-misc/xdotool might come in handy. Its command windowmove is able to move a window. You will probably have to find the name of the task bar window first. Try xlsclients (x11-apps/xlsclients) or xwininfo (x11-apps/xwininfo).

Code: Select all

xwininfo -root -tree
You may need the window's identification number (ID) instead of its name for xdotool. The name should be the same for all your X11 sessions, but the ID may change. The script for the ACPI event handler would have to translate the window name into the ID every time it's called, for instance with xwininfo.

Code: Select all

xwininfo -int -name 'name_of_window'
(replace name_of_window)

Eventually, cinnamon desktop should provide the missing event handler.
Top
mark4
Apprentice
Apprentice
Posts: 219
Joined: Sat Feb 26, 2011 2:34 pm

  • Quote

Post by mark4 » Wed Jul 16, 2025 2:22 pm

wildhorse wrote:Check if the lid switch triggers an ACPI event. There should be an entry called something like "lid" in /proc/acpi/. You can add your own event handler to /etc/acpi/, provided you have sys-power/acpid installed.

Code: Select all

find /proc/acpi/ -name \*lid\*
Unhandled ACPI events end up entry in the system log (typically /var/log/messages).

A little tool called x11-misc/xdotool might come in handy. Its command windowmove is able to move a window. You will probably have to find the name of the task bar window first. Try xlsclients (x11-apps/xlsclients) or xwininfo (x11-apps/xwininfo).

Code: Select all

xwininfo -root -tree
You may need the window's identification number (ID) instead of its name for xdotool. The name should be the same for all your X11 sessions, but the ID may change. The script for the ACPI event handler would have to translate the window name into the ID every time it's called, for instance with xwininfo.

Code: Select all

xwininfo -int -name 'name_of_window'
(replace name_of_window)

Eventually, cinnamon desktop should provide the missing event handler.

This is probably one of the most detailed replies I have ever had here! Unfortunately I failed to get past the final boss, that list of windows has a lot of info in it but nothing jumps out at me as being the taskbar. There are no named entries that seem like they may be it and none of the positional info seems to be helpful here either lol

Do you think the cinnamon devs would have this on their todo?
Top
wildhorse
Apprentice
Apprentice
User avatar
Posts: 185
Joined: Thu Mar 16, 2006 3:59 am
Location: Estados Unidos De América

  • Quote

Post by wildhorse » Wed Jul 16, 2025 3:12 pm

I assume that the lid switch does indeed trigger ACPI events.

Try

Code: Select all

xwininfo -int
Move the crossbar cursor over the most outer component of the task bar and press the left mouse button. That may give you some information.

It is possible, that the task bar window has no name and that it is just a child window of some other window. You can use the "window id" which you just got and try to locate it within the output of

Code: Select all

xwininfo -root -tree
The cinnamon developers might find your request either great (I do) or too specific. What they might support is a request for calling a handler (application or script) in addition to the already existing list of handlers (suspend, shutdown etc.).

You could look into the source code of cinnamon and try to locate the part that creates the task bar window. Start with identifying the package that provides the task bar. Start with

Code: Select all

qlist -IC gnome-extra/cinnamon
(qlist is part of app-portage/portage-utils). Post the answer here. I might look into this matter myself next weekend.
Top
mark4
Apprentice
Apprentice
Posts: 219
Joined: Sat Feb 26, 2011 2:34 pm

  • Quote

Post by mark4 » Wed Jul 16, 2025 3:26 pm

wildhorse wrote:I assume that the lid switch does indeed trigger ACPI events.

Try

Code: Select all

xwininfo -int
Move the crossbar cursor over the most outer component of the task bar and press the left mouse button. That may give you some information.

It is possible, that the task bar window has no name and that it is just a child window of some other window. You can use the "window id" which you just got and try to locate it within the output of

Code: Select all

xwininfo -root -tree
The cinnamon developers might find your request either great (I do) or too specific. What they might support is a request for calling a handler (application or script) in addition to the already existing list of handlers (suspend, shutdown etc.).

You could look into the source code of cinnamon and try to locate the part that creates the task bar window. Start with identifying the package that provides the task bar. Start with

Code: Select all

qlist -IC gnome-extra/cinnamon
(qlist is part of app-portage/portage-utils). Post the answer here. I might look into this matter myself next weekend.
Yes the lid switch can trigger ACPI events.

i placed the + over various places in the task bar, to experiment. An area that has nothing overlapping it such as no buttons or other items reports the following ...

xwininfo: Window id: 454 (has no name)

Absolute upper-left X: 0
Absolute upper-left Y: 0
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 3840
Height: 2160
Depth: 24
Visual: 0x21
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: yes
Corners: +0+0 -0+0 -0-0 +0-0
-geometry 3840x2160+0+0

Which makes no sense to me because the geometry is over the entire display size not just the width and height of the visible task bar so I have to question whether or not im getting info on the task bar and not the root window :/

Ill see if I can track down the source code for the bar, i have never done X development before but it was always on my todo list "some day" lol. Im currently trying to get sigwinch handling in my from scratch curses lib to not mysteriously crash "sometimes" lol. I think i could take a break for a day and research the task bar some!
Top
mark4
Apprentice
Apprentice
Posts: 219
Joined: Sat Feb 26, 2011 2:34 pm

qlist

  • Quote

Post by mark4 » Wed Jul 16, 2025 3:54 pm

gnome-extra/cinnamon
gnome-extra/cinnamon-control-center
gnome-extra/cinnamon-desktop
gnome-extra/cinnamon-menus
gnome-extra/cinnamon-screensaver
gnome-extra/cinnamon-session
gnome-extra/cinnamon-settings-daemon
gnome-extra/cinnamon-translations

would have to dig deeper because bothncontro-center and menus seem like candidates for where to put the taskbar code :)


looking in /var/cache/distfiles at the cinnamon packages i see that cinnamon-control-center has stuff related to panels but i cant tell if it is using the name "panel" for some other entity or not.
Top
mark4
Apprentice
Apprentice
Posts: 219
Joined: Sat Feb 26, 2011 2:34 pm

brain dead update lol :)

  • Quote

Post by mark4 » Wed Jul 16, 2025 11:31 pm

I have been trying to get turbo working with my CPU under linux which has been locked to 2.1Ghz where windows would jack all the way to 5.xGhz regularly. I have tried many different distributions live media and I just tried Arch (ick) and TURBO WORKED so... I copied the config.gz and emerged a similar kernel version and used their config to build my kernel

and what do you know, not only is turbo now (sort of) working, just not to 5ghz, just 3.xGhz, I also seem to have my taskbar switching to the external monitor when I close the lid. Only change is from a 6.15 kernel to a 5.15 kernel.
Top
wildhorse
Apprentice
Apprentice
User avatar
Posts: 185
Joined: Thu Mar 16, 2006 3:59 am
Location: Estados Unidos De América

  • Quote

Post by wildhorse » Thu Jul 17, 2025 8:51 am

Make sure that

Code: Select all

echo $XDG_SESSION_TYPE
shows x11 and

Code: Select all

ps ax|grep -v grep|grep --colour /usr/bin/X
lists the process of the X server.

I am not using cinnamon.
See if you can move the mouse cursor over a point of the taskbar where no button or anything like that is located.
Press the right mouse button. That should open a pop-up menu. It allows you to move the taskbar elsewhere by moving the mouse within the pop-up menu and pressing the left mouse button. The second screen should be listed in the menu as target.
If all that works, then try

Code: Select all

xdotool mousemove --screen 0 --sync 500 600 click 3 sleep 0.1 mousemove_relative --sync 10 110 sleep 0.1 click 1
whereby the first coordinate is the position of the taskbar's top left corner and the second coordinate is the relative position within the pop-up menu. The options "--sync" and "sleep 0.1" are important.
You can experiment with xdotool simply by moving the mouse cursor. Also verify the screen number.
If xdotool allows you to move the taskbar and the lid switch triggers two different kinds of events for open and close, then you have the option to move the taskbar back and forth with two ACPI event handlers.
Top
Hu
Administrator
Administrator
Posts: 24401
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Jul 17, 2025 1:16 pm

If you just need to check that X is running, I think ps -C X will be simpler than listing everything and then discarding non-matching lines.
Top
mark4
Apprentice
Apprentice
Posts: 219
Joined: Sat Feb 26, 2011 2:34 pm

  • Quote

Post by mark4 » Thu Jul 17, 2025 1:47 pm

wildhorse wrote:Make sure that

Code: Select all

echo $XDG_SESSION_TYPE
shows x11 and

Code: Select all

ps ax|grep -v grep|grep --colour /usr/bin/X
lists the process of the X server.

I am not using cinnamon.
See if you can move the mouse cursor over a point of the taskbar where no button or anything like that is located.
Press the right mouse button. That should open a pop-up menu. It allows you to move the taskbar elsewhere by moving the mouse within the pop-up menu and pressing the left mouse button. The second screen should be listed in the menu as target.
If all that works, then try

Code: Select all

xdotool mousemove --screen 0 --sync 500 600 click 3 sleep 0.1 mousemove_relative --sync 10 110 sleep 0.1 click 1
whereby the first coordinate is the position of the taskbar's top left corner and the second coordinate is the relative position within the pop-up menu. The options "--sync" and "sleep 0.1" are important.
You can experiment with xdotool simply by moving the mouse cursor. Also verify the screen number.
If xdotool allows you to move the taskbar and the lid switch triggers two different kinds of events for open and close, then you have the option to move the taskbar back and forth with two ACPI event handlers.
mark4@MTECH ~ $ echo $XDG_SESSION_TYPE
tty

mark4@MTECH ~ $ ps ax|grep -v grep|grep --colour /usr/bin/X
3984 tty1 S<l 0:12 /usr/bin/X -nolisten tcp -keeptty :0 -auth /tmp/serverauth.tRcaWcQ3q3 vt1

The menu item in the popup for cinnamons takbar lets you move the taskbar to any edge of the display. I am not sure how your xdotool command can interact with the taskbar or its menu, the menu disappears if I click in the terminal to type anything.


If I run kernel 6.15.x closing the lid does not move the taskbar to the external monitor but in 5.15.x it does. Unfortunately I cant get my Intel Corporation Raptor Lake-S PCH CNVi WiFi (rev 11) to work in 5.15 so I have to use wired network there till I figure that out. I see firmware load failures in dmesg for 5.15 (firmware is not compressed).
Top
Post Reply

10 posts • Page 1 of 1

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic