Sitelet https://github.com/forge-ext/forge/pull/307
Skip to content

Add non persistant toggle float - #307

Merged
jmmaranan merged 5 commits into
forge-ext:mainfrom
p1gp1g:feat/non-persistant-toggle-float
Dec 2, 2023
Merged

jmmaranan merged 5 commits into
forge-ext:mainfrom
p1gp1g:feat/non-persistant-toggle-float

Conversation

@p1gp1g

@p1gp1g p1gp1g commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

This PR introduces a new shortcut (window-nonpersistent-toggle-float) for non-persistent float toggle. This uses the window id to identify the window to float.

This should fixe #172, #242 and #292.


In my opinion, it would be better to:

  1. Gives this new shortcut behavior to window-toggle-float instead of creating a new shortcut
  2. Add a dialog to window-toggle-always-float to let the user choose if they want to float the class, to float the class with a title, to delete a rule related to the active app (rules without wmId) or to abort.

If you agree, I can edit the PR to follow point 1. But this may introduce a breaking change for users they use this shortcut as a permanent toggle (which is confusing because of its name). Because of this breaking change I have open a PR with a new shortcut. But I think the breaking change is worth it. Please let me know if you're ok to change window-toggle-float instead of adding a new shortcut.

Else, I think the shortcut should be renamed, for instance:

  • window-nonpersistent-toggle-float => window-toggle-float
  • window-toggle-float => window-always-float
  • window-toggle-always-float => window-withTitle-always-float

@ghost

ghost commented Oct 28, 2023

Copy link
Copy Markdown

p1gp1g, It still doesn't fix the problem that you would have to have 5 different keybindings for toggling float, i came up with a better way to handle it, the thing is if someone is willing to work on it.

#292

@p1gp1g

p1gp1g commented Oct 29, 2023 •

Copy link
Copy Markdown
Contributor Author

Sorry, I think something has been confusing. Why would you need 5 different keybindings ? Isn't this PR implementing what you talked about in #292 ?

Currently, there are 2 keybindings:

  1. One to permanently float window based on its class name
  2. One to permanently float window based on its class name + its title.

None of them can be used to temporarily float a single window. For instance, I use it a lot to take screenshots of windows. + Using those 2 previous keybindings to temporarily toggle a window can have side effects like floating other windows, or override some rules (which is annoying).

This PR adds a keybinding to add a floating rule based on the window ID.

PS: Sorry If I was not very clear in a first time :). Or do I miss something ?

@jmmaranan

Copy link
Copy Markdown
Collaborator

Hi @p1gp1g and @RyanOrigens

I tested this quite a bit. I think the Super + c should be using the window.id instead of the window.title to temporarily float the window. But it should only be saved in memory and not on the windows.json config. If you want it to be permanent, press the Super + Shift + c and stores it by window.wmclass.

For #292 - I do not know how to do timing by keypresses.

For my original workflow, Super + c was to maintain focus on the window and bringing it front and center temporarily. I got that from Magnet (Mac) but I did not like a very tall window nor a very wide one but just enough percentage of the screen size. I also intended the percentages to be configurable but I had to ship it.

With that said, I think maintaining only 2 shortcuts to float things: temporary and permanent would be optimal and much simpler.

@jmmaranan

Copy link
Copy Markdown
Collaborator

Oh and before I forget, the window.id is a sequential number if that gets into windows.json - it will fill it up very fast without a way to remove the unused ones unless implemented in the PR.

@p1gp1g p1gp1g closed this Nov 2, 2023
@p1gp1g p1gp1g reopened this Nov 2, 2023
@p1gp1g

p1gp1g commented Nov 2, 2023

Copy link
Copy Markdown
Contributor Author

Oh and before I forget, the window.id is a sequential number if that gets into windows.json - it will fill it up very fast without a way to remove the unused ones unless implemented in the PR.

This is the reason for this change : https://github.com/forge-ext/forge/pull/307/files#diff-ecc5aba1b19feb12aedd8037846a95297082072be1a704814195edb468f846dfR71-R73

When you start your session, it will load the floating rules and filter out the ones with wmId, so when you will toggle anything during this session it will remove the old ones. That is not perfect and not writing at all may be implemented but it does have to be in this PR (to reduce the PR size, and because something is already in place to avoid ever growing windows.json)

PS: Sorry for the missclick that have closed the PR right before

@p1gp1g

p1gp1g commented Nov 2, 2023

Copy link
Copy Markdown
Contributor Author

With that said, I think maintaining only 2 shortcuts to float things: temporary and permanent would be optimal and much simpler.

I'm pretty OK with this. I can edit that PR if you want. Should the permanent one includes the wmTitle or not ?

@jmmaranan

Copy link
Copy Markdown
Collaborator

@p1gp1g - the permanent one should include the wm_class only

Comment thread lib/extension/window.js Outdated
@p1gp1g

p1gp1g commented Nov 8, 2023

Copy link
Copy Markdown
Contributor Author

@jmmaranan : I've set the non-persistent behavior to window-toggle-float. window-toggle-always-float does not use wmId but wmTitle.

I've suggested a small change to make it cleaner if you want.

@p1gp1g
p1gp1g force-pushed the feat/non-persistant-toggle-float branch from 2f4215b to 99e1cb8 Compare November 28, 2023 10:01
@p1gp1g

p1gp1g commented Nov 28, 2023

Copy link
Copy Markdown
Contributor Author

@ p1gp1g - the permanent one should include the wm_class only

Done with 99e1cb8

@jmmaranan
jmmaranan merged commit 98c84b1 into forge-ext:main Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants