Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

New feature idea for version 4 #63

Closed Tomas-M closed 6 years ago

Tomas-M commented 6 years ago

I have an idea, it is not necessary to implement it now, I just think that it would be cool to have this in the future.

It could be useful if user has a power to put icons on pre-defined fixed position. This way, user could place extra icons on the screen. As an example, user could put a rounded arrow (refresh) and after clicking, it would call script to regenerate xlunch entries. Or, user could put an icon with X, which would close xlunch. Those actions can be of course added to existing grid, but if the user can make them fixed position, he can for example put them in corners of the screen, outside of the grid.

User could, for example, make any of his icons absolutely positioned, by providing coordinates as extra x;y parameters in dsv file:

Close;close.png;/bin/exit;0;0
Refresh;refresh.png;/bin/refresh;-100;-100

Positive value would mean position from the left (for x) and top (for y). Negative value would mean position from right (for x) and bottom (for y). Optionally it could be position from bottom right minus size of the given particular icon (so user could put there -0;-0 and he can be sure the bottom right corner of the icon will be in the bootom right corner of the screen).

For these special icons, there would be no higlight, no label, and these icons would be placed in their original size (not resizing to --iconsize).

This way, one could put various icons on various places on the screen, for example like these shutdown/logout icons on Windows screen (see top right):

clip_image0071

Since there would be no highlight for such icons, we could extend the syntax of dsv file to provide one icon path for the icon, and another icon path for highlighted icon.

This way, user could create various buttons aligned to the sides or corners of the screen, even with over effects, which would otherwise work very same as other xlunch entries.

Furthermore user would be able to even make the screens as like on the screenshot entirely, if he provides the pictures.

This possibility of placing icons outside of the grid would extend the usability of xlunch very much.

This is just an idea. For future.

PMunch commented 6 years ago

I liked this idea so much that I went ahead and implemented a version of it in https://github.com/Tomas-M/xlunch/commit/a170ccbb0e0cff65bf1c355b319c18f989ff0b2f. There is now a new argument -A, --button which takes a semi-colon separated list on the form <normal icon>;<highlight icon>;<x>,<y>;<command>, if highlight icon is left out it will just use normal icon for both normal and highlights. If x or y is negative they are relative to the opposite side of the screen as you mentioned.

Most people aren't likely to go as crazy as replicating the entire Windows start menu (although it is possible) but rather just add a couple of buttons. So I think it's fine for now that buttons are passed individually through an option and not through the entries file. I am also considering to start implementing the configuration format which would mean a configuration file could be passed instead of all the options on the command line. Something like (my actual config (sans buttons) rewritten as a config file):

iconsize: 64
selectonly
voidclickterminate
textafter
leastmargin: 10
columns: 3
rows: 5
border: 250
sideborder: 300
promptfont: Raleway-ExtraLight/24
font: mplus/mplus-2p-light/13
promptcolor: 6d91ffff
textcolor: ccccccff
backgroundcolor: 2d303b00
background: $HOME/Pictures/vignette3.png
outputonly
input: $HOME/.config/xlunch/recent.dsv
button: $HOME/Pictures/shutdown.png;;20,20;shutdown
button: $HOME/Pictures/logout.png;;45,20;logout
button: $HOME/Pictures/lock.png;;70,20;lock

Then xlunch can be started with that config file and the possibility to override the options through arguments.

Tomas-M commented 6 years ago

Oh this is awesome! :-) Can I use the commandline parameter --button multiple times to specify more than one icon?

Tomas-M commented 6 years ago

OK I tried it. It understands more buttons, that is cool. One problem I noticed is that I wasn't quoting the arguments, and my bash considered the semicolon as end of command. Furthermore, I find it a little bit confusing to use semicolon on one place, but comma at different place (x,y). Would it be possible to use only commas? Like --button <icon>,<highlight icon (optional)>,<x>,<y>,<command>

That way, user cannot make mistake by forgotting the quotes, and it seems more intuitive to me to use only single separator.

Tomas-M commented 6 years ago

Also I noticed that when not specifying the highlight icon, hovering hides the button, I would expect to keep it there the same ... :-) maybe a bug

Tomas-M commented 6 years ago

Ah, now I understand, it is optional, but if not specified, there needs to be ;; like --button <icon>;;<x>,<y>;<command>

I thought it should be like --button <icon>;<x>,<y>;<command>

You can see a confused user in action here :-)

Tomas-M commented 6 years ago

By the way, it is not possible to place a button -0,-0 position in bottom-right corner, since -0 -0 is understood by atoi() as 0:0 and places it at the top left corner. I understand that negative zero is somehow matemaically incorrect :-) but I would prefer to keep the syntax, and make the code understand the difference.

PMunch commented 6 years ago

A single separator is easy to change to, the code has a special case for using ',' between coordinates since that's how they are normally written. For me that field is a "placement" field which takes a coordinate like "," we could concievably make other placements if we wanted (things like "beforeprompt", "afterprompt", "topleft", "bottomright", "center,100" etc.).

I can see how the optional parameter can be a bit confusing, but it's the same as in the entries.dsv and I show an example without the highlight on the webpage so I don't think it will be a huge problem for new users reading the docs.

Yeah, I'm still trying to find a good way to do -0,-0 without having to parse the string each time we want to draw it or store extra state about the numbers. Currently the decision on were to draw it is done when the icon is drawn, so you can resize the window and still have it appear relative to the bottom and right. What I could do is parse -0,-0 in as -1,-1 and subtract 1 from all the other numbers as well, then add them back when we want to draw them. It's a bit hacky but it should work fine.

Tomas-M commented 6 years ago

I could specify -1,-1 myself in the parameters, but this would leave a 1px space between the border of the screen and the icon. Visually this may not be a big issue, but user experience would be damaged by this - it is because if user moves his mouse to the corner or edge, the mouse goes exactly to the last pixel on the edge, and thus user would not be able to click the icon if his mouse is at the edge. It's an usability thing ... :)

If you put -0,-0 internally as -1,-1 then user who really wants -1,-1 will get -0,-0 instead, right? I would suggest to remember that there was a minus sign in some extra variable, and then store absolute value in x/y variables. May be not ideal but will work 100%

PMunch commented 6 years ago

Oh no you misunderstood. -0,-0 would get represented internally as -1,-1. If the user specifies -1,-1 it would be represented as -2,-2. Then when we draw things that have negative coordinates they will be shifted back, so -0,-0 would be bottom right corner and -1,-1 would be one pixel away from the bottom right corner. The only place we lose precision is at the end of the int range, but I don't think anyone has a screen that big (yet?) :P

PMunch commented 6 years ago

Added my fix in https://github.com/Tomas-M/xlunch/commit/18b940b305b689fa2fafb87be7921a364b5376cc, now you are able to do -0,-0 and it will put it at the bottom right without any pixels between it and the edge.

PMunch commented 6 years ago

I think between this and the option to read configuration files as implemented in https://github.com/Tomas-M/xlunch/commit/3fdf27a4ce9ed3c3e571bacb11854593ec48355e it might be time for a version bump (at least minor version).

Tomas-M commented 6 years ago

Ah, clever idea with -0 -0 as -1 -1, now I understand ! :)

Tomas-M commented 6 years ago

Minor feedback: mouse cursor could probably switch to pointer (hand) as like on regular icons, if it is over a "button", so user has a feedback that it is clickable.

PMunch commented 6 years ago

Added mouse cursor change in https://github.com/Tomas-M/xlunch/commit/7d1130ee9eb24d2b43c02c30a511361e8cf87667

Tomas-M commented 6 years ago

Thank you very much for implementing this. I can imagine what endless possibilities are available now, various fullscreen setups, various menu-like setups, lots of cool stuff. Good work! :)

PMunch commented 6 years ago

I also added some more menu-friendly options yesterday. Especially the positioning of the entries block to allow split layouts with entries on one side and buttons on the other and the exit on focus lost feature to allow menus to appear more as popups.

Tomas-M commented 6 years ago

I am afraid I missed that. What options are those to split layouts to sides?

PMunch commented 6 years ago

--borderratio and --sideborderratio

Tomas-M commented 6 years ago

I have an idea which can make the buttons even more useful, I believe. I'm writing it here for your consideration :)

It would require buttons to support one more argument: hidden (or visible). Initial value could be read from the button parameters, as like --button <icon>,<highlight icon (optional)>,<x>,<y>,<hidden/visible>,<command>

And we can add an internal commands :hide <n> and :show <n> and :toggle <n>. So clicking a button could hide/show/toggle other buttons (indexed by n). This way, the user could show/hide other buttons without the need to restart xlunch or rebuild the config file. I think it adds another level of flexibility. I hope you like it :-)