Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart trimming of window titles #9

Open
wants to merge 1 commit into
base: pygi-python3
Choose a base branch
from

Conversation

stuartlangridge
Copy link

Please note: this pull request is not intended for merging in its current state! This is to provide a basis for discussion, after the fixes suggested in #8.

In particular, I can't be sure this works. The title trimming works (I tested that), but now that I've added a new preference to the gsettings schema, I can't start up my version of dockbarx any more because it now throws an error: Settings schema 'org.dockbarx.dockbarx' does not contain a key named 'preview-trim'. I don't know how to use my "updated" gsettings schema without forcing it to install instead of the standard one, and that will break the actual installation of dockbarx that I have on my desktop! So this is a proposal, which you might want to think about, and decide whether you like it, and maybe make changes to. The full description is below.


Add a new preference, "Smart title trimming".
In the list of previews for an application, this shortens the titles of the windows in that application by removing common prefixes and suffixes from those titles. For example, if you have some Terminal windows open, with titles:

stuart@machine: ~ - Terminal
stuart@machine: ~/Pictures - Terminal
stuart@machine: ~/Documents - Terminal
stuart@machine: ~/.local/share - Terminal

then these will likely be too long to be shown in their entirety in the window list. This preference changes the displayed titles in the window list to remove the common substrings at start and end, so the entries in the list would look like this:

… ~ …
… ~/Pictures …
… ~/Documents …
… ~/.local/share …

The preference defaults to off. It's named "Smart title trimming" because more technical descriptive names such as "Remove common prefix and suffix from preview window titles" sound confusingly "techie".

Add a new preference, "Smart title trimming".
In the list of previews for an application, this shortens the titles of the windows in that application by removing common prefixes and suffixes from those titles.
For example, if you have some Terminal windows open, with titles:
```
stuart@machine: ~ - Terminal
stuart@machine: ~/Pictures - Terminal
stuart@machine: ~/Documents - Terminal
stuart@machine: ~/.local/share - Terminal
```
then these will likely be too long to be shown in their entirety in the window list.
This preference changes the displayed titles in the window list to remove the common substrings at start and end, so the entries in the list would look like this:
```
… ~ …
… ~/Pictures …
… ~/Documents …
… ~/.local/share …
```
The preference defaults to off. It's named "Smart title trimming" because more technical descriptive names such as "Remove common prefix and suffix from preview window titles" sound confusingly "techie".
@xuzhen
Copy link
Owner

xuzhen commented Nov 19, 2023

I think this is a bit radical. It would be too confident to assume that all common prefix/suffix in titles is meaningless to all users.

In my opinion, the current implementation of automatically setting the ellipsize mode according to the position of common text appears is good enough for most users.

@stuartlangridge
Copy link
Author

stuartlangridge commented Nov 19, 2023

Fair enough! I can only tell you that I find the current setup difficult for Terminal windows, because the window list looks like this:

image

and that's not very helpful. (The preview width adjustment doesn't change the width of the menu when there aren't visual previews). But I understand that this is maybe an unusual case and there's no need to have something in the main codebase to deal with it. (It is a preference, of course, so "smart title trimming" needs to be turned on in the preferences window; it wouldn't affect anyone unless they want it to.)

Is this maybe something I can fix for myself with a plugin of some kind? Then I could write myself a plugin and install it and it wouldn't affect the base code. But I don't know whether it's possible to have plugins for dockbarx.

@xuzhen
Copy link
Owner

xuzhen commented Nov 21, 2023

I can only tell you that I find the current setup difficult for Terminal windows, because the window list looks like this:

and that's not very helpful. (The preview width adjustment doesn't change the width of the menu when there aren't visual previews).

It seems that you have not upgraded the dockbarx packages to 1:1.0~beta3+git20231116-1~ppa1. With the latest version, the common suffix/prefix will be ellipsized if the title is too long

a
b

And you can also change the width of title without touch the preview size

c

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.

None yet

2 participants