Go to specified panel position action

This is the place to ask "How do I ...?"
Post Reply
exnova
Posts: 5
Joined: Sat May 09, 2020 8:23 pm

Go to specified panel position action

Post by exnova » Sat May 09, 2020 8:42 pm

Hello,

I have a panel that is 3 desktops wide, scrollable.
I'd like to assign Home key to scroll it back to the middle section.
I was looking into Bookmarks, but can't see how one can be launched with an action, only a shortcut.

exnova
Posts: 5
Joined: Sat May 09, 2020 8:23 pm

Re: Go to specified panel position action

Post by exnova » Fri May 15, 2020 4:06 pm

Did I really discovered something this Launcher can't do? Even with a script?
To be clear, I just want to replicate the "Go to home desktop" action, but for a panel instead of the desktop.

User avatar
F43nd1r
Posts: 50
Joined: Thu Jan 24, 2019 1:20 pm

Re: Go to specified panel position action

Post by F43nd1r » Fri May 15, 2020 8:13 pm

First, to get the terminology straight: I think you're talking about pages, as LL has a concept of multiple desktops which aren't connected to each other.

Second, scripts can do that. Something along the lines of

Code: Select all

getActiveScreen().getContainerById(<your panel container id>).setPosition(0,0)

exnova
Posts: 5
Joined: Sat May 09, 2020 8:23 pm

Re: Go to specified panel position action

Post by exnova » Sat May 16, 2020 11:40 pm

Thanks!
Although the script doesn't make my panel scroll, I should probably figure it out, now that I know the correct approach.

edit: can't get it to work after all :(

exnova
Posts: 5
Joined: Sat May 09, 2020 8:23 pm

Re: Go to specified panel position action

Post by exnova » Tue May 26, 2020 1:14 am

I only managed to move the panel, not scroll it. Using:

Code: Select all

getActiveScreen().getItemById(<your panel container id>).setPosition(0,0)
Can setPosition be used to scroll as well?
Or do I need to create 3 panels, instead of having one that's 3 pages wide?

Also I had to add "0x" to the start of panel ID, taken from the hierarchy. Just wanted to mention it's not obvious from the documentation.

User avatar
F43nd1r
Posts: 50
Joined: Thu Jan 24, 2019 1:20 pm

Re: Go to specified panel position action

Post by F43nd1r » Wed May 27, 2020 12:03 am

You need to get the container, not the item. My script above uses the container id. If you want to use the item id, use

Code: Select all

getItemById(...).getContainer().setPosition(...)

exnova
Posts: 5
Joined: Sat May 09, 2020 8:23 pm

Re: Go to specified panel position action

Post by exnova » Wed May 27, 2020 2:45 am

Thanks, now it works!
I did need to add getActiveScreen() at the beginning, otherwise I got: "getItemById" is not defined"
so

Code: Select all

getActiveScreen().getItemById(0x<panel item id>).getContainer().setPosition(0,0)
I guess I just incorrectly assumed the Panel's id in the hierarchy is the container id.

Post Reply