zeroxoneafour / kwin-autotile

Autotile script for kwin
https://store.kde.org/p/2003956
MIT License
43 stars 1 forks source link

Some possible QOL additions [enchancement] #2

Open IDeathByte opened 1 year ago

IDeathByte commented 1 year ago

Sorry, idk where to find API docs to new tile system for adequate write and connect functions, but i can suggest some improvements:

1) Floating windows always on top: In theory, we can add window role for black/whitelisted apps (client.resourceClass, if i right understand code) Or make another list for app, what's we need to guaranteed been floating

2) Prevent change screen, when retiling As i see, we has func desctopChange with checking client.screen, but now on retiling it can change current app screen to main. Maybe we need add function for checking selected screen on retile, orr add suboption for app for remember it.

3) Add possiblity to save/remove user templates Now we has only 3 default template on tile management screen. Idk, where find access to this, but if possible, we can realize this with create 2 new lists: 1 with user templates and second with default user, what's replace default list, if we has our custom templates, and add func to checking, for prevent user remove defaults.

4) Rearranging tiling inside areas and in global screen area through key combos (if possible)

5) Some code improvements Like replace black/whitelists and some another lists from Array to Map's/Set, for prevent addition of same names and redundant rechecking through loops

zeroxoneafour commented 1 year ago

I can give you a general idea about some of these suggestions right now, but some of the possible ones may not be implemented for a while because I have school tomorrow.

  1. This is the purpose of the blacklist, and floating windows are always on top, at least in the latest release (0.2.2). Window roles kind of work, kind of don't on Wayland.
  2. I cannot test this as I do not own more than 1 screen, can you be more specific?
  3. This functionality is provided through KWin, and there's not really anything I can do about it with this script. I believe there is functionality to save layouts somewhere, though.
  4. I can probably come up with something
  5. Unfortunately, I need to check every individual element in the blacklist because I need to see if the strings include each other. I have code in place for a blacklist cache, which uses a set to see if that type of window has already been checked. This should somewhat improve performance.
zeroxoneafour commented 1 year ago

A lot of keyboard shortcuts were added with v0.3.0. Try some of them out if you'd like, and see if there are any more you need.

IDeathByte commented 1 year ago

Seems like combos not work under wayland (not tested on x11)

Also idea for improvement - add possibility lo remember app position in grid. If we has some apps, whats we launch on autostart, will be good to remember and restore his arrangement on session start.

Also there no publik API from kde? Ill be heppy to join on project, but you does work in blind... meh. You a hero

zeroxoneafour commented 1 year ago

Keyboard shortcuts work for me, have you updated your script and shortcuts? I know for a fact that they won't work (along with most other things) on X11.

I don't think there's any way to remember app position through a script, as scripts don't offer any persistent data that I know of other than configs.

IDeathByte commented 1 year ago

as i see, in tileClient func, you checking free position through loop If i understand righ, tiling list it array of arrays, t.tiles.length is option of current subtile, and t.tiles is position, and all list seems like [tile, [tile, [tile, [etc...]]]] (if i understand, it also a reason, why you can work only with binary windows)

for save current app position, we can add option for required apps, and save count data from this loop into cache or something like. And for restoration, just use counter for app. like, while count != 0 make new subArr, if subpos = 0, place here, else make new and place here


Key combos did,t work for me Seems like focused window intercept keyboard input and has higher priority over system shortcuts In bismuth works correctly. maybe we need some extra methods?

zeroxoneafour commented 1 year ago

I guess I could add an option like that, but it would not persist on restart and would only work if the layout was created in the right order to be able to place the tile where it's needed. Honestly I don't really see a use case for this feature and don't remember anything similar on i3 or dwm or anything but what could go wrong I guess?

If keyboard shortcuts don't work and interfere with applications, I think you may just have to change them. KWin should have priority in most places and almost no applications I know of use the meta key and can't be configured otherwise. Sorry, but I just don't think there's a way to make script keybinds override app shortcuts if they don't already. Bismuth probably had some weird and not entirely scripted way that they did it, if they did.

IDeathByte commented 1 year ago

I tried to change it several times. It doesn't work for some reason. Also i tried on different apps, whats doesn't has crossed combos - it just don't recognize commands.

zeroxoneafour commented 1 year ago

Did you update the script to v1.0.0 and restart KWin? If you did, this may be a larger bug with the script. Turn on debug mode in the settings and restart Plasma. Execute the following command after trying to use a few keybinds -

journalctl --user --no-pager -e | grep "Autotile DBG"

and give me the output.

IDeathByte commented 1 year ago

seems like it just didn't catch any input. i bind untile/retile into meta+f, but it similar to any combinations

мар 21 17:44:23 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Config Updated мар 21 17:44:23 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: useWhitelist == false мар 21 17:44:23 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: blacklist == krunner,yakuake,zerotier-gui,steam,gamescope,spectacle,dolphin,org.kde.polkit-kde-authentication-agent-1,org.kde.kdesu,octopi-sudo,xdg-desktop-portal-kde,org.freedesktop.impl.portal.desktop.kde,lutris,yakuake,org.qbittorrent.qBittorrent,org.kde.plasmashell,org.kde.kdialog,pamac-installer,electron мар 21 17:44:23 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: tileDialogs == false мар 21 17:44:23 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: borders == 1 мар 21 17:44:23 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: invertInsertion == true мар 21 17:44:25 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Config Updated мар 21 17:44:25 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: useWhitelist == false мар 21 17:44:25 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: blacklist == krunner,yakuake,zerotier-gui,steam,gamescope,spectacle,dolphin,org.kde.polkit-kde-authentication-agent-1,org.kde.kdesu,octopi-sudo,xdg-desktop-portal-kde,org.freedesktop.impl.portal.desktop.kde,lutris,yakuake,org.qbittorrent.qBittorrent,org.kde.plasmashell,org.kde.kdialog,pamac-installer,electron мар 21 17:44:25 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: tileDialogs == false мар 21 17:44:25 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: borders == 1 мар 21 17:44:25 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: invertInsertion == true мар 21 17:44:28 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Tiling client WebCord мар 21 17:44:34 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Tiling client firefoxdeveloperedition мар 21 17:44:38 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Tiling client org.kde.konsole мар 21 17:44:48 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: WebCord was moved out of a tile мар 21 17:48:06 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Tiling client org.telegram.desktop мар 21 17:48:30 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop minimized мар 21 17:48:30 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop unminimized мар 21 17:48:31 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop minimized мар 21 17:48:32 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop unminimized мар 21 17:48:32 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop minimized мар 21 17:48:33 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop unminimized мар 21 17:48:43 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop minimized мар 21 17:48:43 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client org.telegram.desktop unminimized мар 21 17:52:09 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: firefoxdeveloperedition was moved out of a tile мар 21 17:52:29 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: firefoxdeveloperedition was moved back into a tile without windows мар 21 17:52:35 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Tiling client vscodium мар 21 17:52:38 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Removing client vscodium мар 21 17:53:35 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: org.telegram.desktop was moved out of a tile мар 21 17:53:37 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: org.telegram.desktop was moved back into a tile without windows мар 21 17:53:39 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: WebCord was moved back into a tile without windows мар 21 17:53:41 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: org.telegram.desktop was moved back into a tile without windows мар 21 17:53:43 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: org.telegram.desktop was moved back into a tile without windows мар 21 17:53:45 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: org.telegram.desktop was moved back into a tile without windows мар 21 17:54:29 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: firefoxdeveloperedition was moved out of a tile мар 21 17:54:38 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: firefoxdeveloperedition was moved back into a tile without windows мар 21 17:54:39 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: firefoxdeveloperedition was moved back into a tile without windows мар 21 17:56:53 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Tiling client systemsettings мар 21 17:56:57 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client systemsettings minimized мар 21 17:56:58 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client systemsettings unminimized мар 21 17:56:59 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client systemsettings minimized мар 21 17:56:59 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: Client systemsettings unminimized мар 21 17:57:03 deathbyte-pc kwin_wayland[1768]: js: Autotile DBG: firefoxdeveloperedition was moved back into a tile without windows

also i see, autoretiling works not all times. maybe it depends to this broke function call, or not in design now: when i move apps to a second screen, or untile this, tiling can doesnt apply automaticaly. I think, it can depends by moving with system shortcuts like meta-shift-arrow, whats make window go out from tile layout. For this case, i think will be good to add event-handler, whats call tile function on move, or tile all windows on screen, what's haven't flag "keep above"

zeroxoneafour commented 1 year ago

I don't see anything in the log that suggested moving windows with keybinds. If you have a window that's untiled, then it will not retile if you move it into a new desktop. Windows will also not tile if there is no space in the layout. Can you send pictures or videos of this?

IDeathByte commented 1 year ago

well, that's exactly that problem - binded combinations doesn't recognized by script. I tried map keys into Untile/Retile shortcut (it duplicated, idk why, but both didn't work) Same for L\R insertion and focus I tried as just restarting kwin, and fully system restart - result same

изображение

Now it empty cause i temporary switched back to bismuth Also, if important, after script installation, shortcuts hasn't been mapped to default from shortcuts.js - maybe it cause crossing with systemwide or just didn't work, but i mapped all manually before restart and test.

Seems like shortcuts just didn't call binded functions. I tried different combos through meta/ctrl/alt etc.

zeroxoneafour commented 1 year ago

I know why the shortcut duplicated, it's because I changed the internal shortcut ID with update 0.3.0. You can go into your ~/.config/kglobalshortcutsrc and delete the entry that just says "RetileWindow"

All I can say for the other issues is that they work on my machine. I can look at it later.

zeroxoneafour commented 1 year ago

Are the shortcuts still broken because they are overwritten by other applications, or could you find a fix?