tuurep / windowlist

Polybar custom module - List all open windows, click to switch focus or minimize
MIT License
9 stars 2 forks source link

New options: configurable click actions #8

Open tuurep opened 9 months ago

tuurep commented 9 months ago

I want it to be possible for user to be able to freely choose which mouse button does which action.

Currently there are only 2 actions:

  1. Left click: Focus and raise OR minimize (inactive/active)
  2. Right click: Close window

Middle click and scroll actions are currently unused. Polywins had neat functionality on them:

  1. Slop resize (technically it was on right click but I swapped it...)
    • It means drawing a rectangle and your window will be resized / placed on that spot
  2. Incremental resize (scroll)
    • I removed it due to not finding it useful, but I do find it cool

One thing that would be extremely neat: just add option to give a path to a script

Ideas for click-action functionality welcome in comments.

tuurep commented 7 months ago

Maybe I could make a folder like:

click-actions/
    close
    minimize
    raise

and those "default" actions are just like:

close

#!/bin/sh

../main --close "$1"

Then the default bindings could be changed with these options:

config.toml

active_window_click_left = "minimize"
inactive_window_click_left = "raise"
active_window_click_right = "close"
inactive_window_click_right = "close"
active_window_click_middle = "none"
inactive_window_click_middle = "none"
active_window_scroll_up = "none"
inactive_window_scroll_down = "none"

More advanced ideas:

Window separators could be clickable, and give 2 arguments to sh script: previous window id and current window id. This would for example make it possible to manually sort windows such that clicking on the separator swaps places of the adjacent two windows.

Clicking on overflow string could give list of all window ids. Close all windows that aren't visible on the bar? Or something like that.

Clicking on empty_desktop_string could for example launch a terminal or whatever.

tuurep commented 7 months ago

Above PR seems like a good solution for window names (only).

A couple questions:

Forces to use system shell, even though using something like python might make sense too.

tuurep commented 7 months ago

User window name click actions now writable in any language as long as:

Hopefully the README explanation is clear.

tuurep commented 6 months ago

Not closing yet since these ideas are still floating around:

More advanced ideas:

Window separators could be clickable, and give 2 arguments to sh script: previous window id and current window id. This would for example make it possible to manually sort windows such that clicking on the separator swaps places of the adjacent two windows.

Clicking on overflow string could give list of all window ids. Close all windows that aren't visible on the bar? Or something like that.

Clicking on empty_desktop_string could for example launch a terminal or whatever.