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

Allow for end user fine-tuned title replacements #7

Closed
kupiqu opened this issue Nov 13, 2018 · 37 comments
Closed

Allow for end user fine-tuned title replacements #7

kupiqu opened this issue Nov 13, 2018 · 37 comments

Comments

@kupiqu
Copy link
Contributor

kupiqu commented Nov 13, 2018

There are a few reasons for why end user fine-tuned title replacements are important:

  • style preference for minimalistic names
  • style preference enhancing system coherence (MATLAB --> Matlab), avoiding redundant or already known information (Firefox web browser, Chromium web browser), or pretty much useless for many users (Gimp-2.10; unless a user has a system with Gimp-2.8 and Gimp-2.10, there is no much benefit; Telegram Desktop, desktop... what else could it be?)
  • available space in horizontal panel is limited (global menu of certain apps is long + system tray + other applets like weather + user switch + buttons + etc). Web browser names are particularly long for, arguably, no reason
  • AppName bugs, e.g., Back In Time at the moment which displays python3 instead of proper name. I reported and sent a pull request to fix this but it is still under processing, and will take a while until this is release, having fine-tuning replacements workarounds the issue until then.

My examples summary (other users may have others):

Firefox web browser --> Firefox
Chromium web browser --> Chromium
Google Chrome --> Chrome
Gimp-2.10 --> Gimp
Telegram Desktop --> Telegram
MATLAB --> Matlab

I have this implemented in a very minimalistic function in https://github.com/kupiqu/plasma-active-application.

If implemented, it seems you prefer not having the replacements in the window settings but in the config file. This is the missing component that would need adjustment.

@psifidotos
Copy link
Owner

I dont have any problem to add this but hidden from the simple user. It means that the user should be able to access that functionality on purpose.

How this can be set:

  1. In the applet qml files by specifying one or two Array(s) in order to contain these information
    -- Cons: in that case if the user installs the applet globally then he should have root privilege in order to update these Array(s) and with each update the information will be lost

  2. In the applets configuration file.
    -- Cons: in that case the user should access the plasmaappletsrc file, locate the settings of that applet and add in that settings the needed information. For Latte the same thing must happen but for .layout.latte files

  3. [2] but provide an elegant and intelligent way to access a ui in settings for this

@kupiqu what is your opinion?

[2] is easy and could be a start... but for [3] I will need something beautiful or if it does not look nice to be hidden from the user somehow...

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

Some on how to do it here: kupiqu/plasma-active-application#1

Function:

function fineTuning(title) {

        var replacements = plasmoid.configuration.titleReplacements;

        replacements = replacements.replace(/\n/g, ";");
        replacements = replacements.replace(/;;/g, ";");
        replacements = replacements.replace(/; | ;/g, ";");
        replacements = replacements.replace(/, | ,/g, ",");

        var appReplacements = replacements.split(";");

        for (var iReplacement = 0; iReplacement < appReplacements.length; iReplacement++){

            if (appReplacements[iReplacement].length > 0) {

                appReplacements[iReplacement] = appReplacements[iReplacement].replace(/"/g, "");

                var repText = appReplacements[iReplacement].split(",");

                var regEx = new RegExp(repText[0], "ig"); //case insensitive
                title = title.replace(regEx,repText[1]);
            }

        }
        return title;
    }

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

[2] is easy and could be a start... but for [3] I will need something beautiful or if it does not look nice to be hidden from the user somehow...

I prefer a nice way [3] (the way I did is not nice) but let's start with [2] for now if you like...

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

one or two Array(s)

the current version of the function parses a single array but can be easily modified

@psifidotos
Copy link
Owner

why regular expressions? is this needed?

@trmdi
Copy link
Contributor

trmdi commented Nov 13, 2018

IMHO you could create a new Config tab, like SystemTray: Config General, Config Entries. In that new tab, you show a table that has columns like "Match", "Replacement". The input value should be Regexp.

@psifidotos
Copy link
Owner

The input value should be Regexp.

why?

@trmdi
Copy link
Contributor

trmdi commented Nov 13, 2018

Because it's powerful for string substitutions.

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

I'm in a hurry so I cannot develop this much now, but:

Regexp are convenient, so you don't have to write so many replacements

Examples:

  • Gimp-2.8 vs. Gimp-2.10 vs. future releases

  • Firefox web browser vs. Navegador web Firefox (ie, language independent)

  • LibreOffice Calc, LibreOffice Writer, ... can all be replaced by the specific app, or the generic in one shot

etc etc

@trmdi
Copy link
Contributor

trmdi commented Nov 13, 2018

If you worry about the performance reduction, you could disable that tab by default.

@psifidotos
Copy link
Owner

My main concern is how this will look nice to the user...

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

I think @trmdi had a great idea about having a table similar to what the weather applet ( https://github.com/kotelnik/plasma-applet-weather-widget) does.

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

Also, this could appear only under enabling advanced options, perhaps?

@psifidotos
Copy link
Owner

I think @trmdi had a great idea about having a table similar to what the weather applet

too crowded...

Also, this could appear only under enabling advanced options, perhaps?

I want to avoid advanced options for applets

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018 via email

@psifidotos
Copy link
Owner

I tried to simplify it a lot... the regexps code is at: https://github.com/psifidotos/applet-window-title/blob/master/contents/tools/Tools.js

I cant test regular expressions because I dont know much... please test and report back...
strings in lists should be between ""

default

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

It works great, thank you!

@trmdi
Copy link
Contributor

trmdi commented Nov 13, 2018

Why not a table? It could look better.

@psifidotos
Copy link
Owner

It could look better.

not in my opinion... it would look heavy loaded...
feel free to provide mockups of course...

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

I sort of agree with @trmdi on this one :) although it will be more difficult to implement, I guess.

This is how the table looks like in the weather plasmoid:

image

Imagine sth similar but only with two fields: original string and new string.

@psifidotos
Copy link
Owner

I cant even look at that image...

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

Mmm... beauty is in the eyes, I guess :)

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 13, 2018

Anyways, it's fine for me either way. the priority is the functionality behind :)

@trmdi
Copy link
Contributor

trmdi commented Nov 14, 2018

not in my opinion... it would look heavy loaded...
feel free to provide mockups of course...

How about this? I think it looks more professional but still keeps being simple.

image

Maybe the last row displays an Add icon button in the Action column.

For each cell: click to enter the edit mode
The Edit button: click to enter the edit mode of the first cell of the row.

@psifidotos
Copy link
Owner

I don't like the actions in the end of the row and I would like to see how you imagine the Add to be done

@psifidotos
Copy link
Owner

psifidotos commented Nov 14, 2018

Things for improvement:

  1. Replace - with trash icon for removal action
  2. Remove the actions for each row
  3. plus for ADD and trash for REMOVE under the bottom right corner of the table
  4. Header titles centered
  5. all valid texts are placed inside ""

@psifidotos
Copy link
Owner

  1. Where the warnings will be shown?

@psifidotos
Copy link
Owner

I would like also someone to tell me the benefits between the current and the proposed ui

@trmdi
Copy link
Contributor

trmdi commented Nov 14, 2018

  1. If you place the Remove button in each Replace cell, users would think that button only clears that cell.
  2. Buttons in the Action column shows that the button actions are applied to the whole row.
  3. The Add button should be in the last row (line 3 in the picture) according to the Fitts's Law I've learned from you.
  4. It should align with other cells.
  5. "" is not necessary.
  6. I don't think it is needed too. You would only add the new record only if both columns are valid.

@trmdi
Copy link
Contributor

trmdi commented Nov 14, 2018

I would like also someone to tell me the benefits between the current and the proposed ui

It looks more professional. It shows the relationship between Match and Replacement value in each row.

@psifidotos
Copy link
Owner

@trmdi even though I believe there will be many issues with your proposal,
you can provide a pull request to test what you have in your mind and discuss in the pull request each and every one contradiction...

@trmdi
Copy link
Contributor

trmdi commented Nov 14, 2018

A mockup with the Add button. But I think I should stop here, because this is not the main feature of the applet. And the current UI is good enough. You were right. There is no noticeable benefit from this.

image

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 14, 2018

Off topic: please correct the typo: Manage substitutions... (note the missing b)

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 14, 2018

Also, upgrading the applet (or perhaps this was after restarting my system, not sure) deleted all my substitutions. Is there a way to prevent this to happen?

@psifidotos
Copy link
Owner

Also, upgrading the applet (or perhaps this was after restarting my system, not sure) deleted all my substitutions.

I changed the string names in the xml file... It shouldnt happen again.

@psifidotos
Copy link
Owner

A mockup with the Add button. But I think I should stop here, because this is not the main feature of the applet. And the current UI is good enough. You were right. There is no noticeable benefit from this.

ok, no problem

@kupiqu
Copy link
Contributor Author

kupiqu commented Nov 14, 2018

I changed the string names in the xml file... It shouldnt happen again.

Thank you

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

No branches or pull requests

3 participants