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

[Feature Request]: Trigger colorchange by terminal command / bash script #126

Open
2 tasks done
k1llerk3ks opened this issue Dec 11, 2024 · 4 comments
Open
2 tasks done
Assignees
Labels
enhancement New feature or request feedbak needed

Comments

@k1llerk3ks
Copy link

I have:

Is your feature request related to a problem? Please describe.
I would love to change the color of the bar, depending on the activity i am on. basically i would love to trigger this by a bash command.

Describe the solution you'd like
some command i can run or file i can edit to change the custom color, without having to open the widget everytime
Describe alternatives you've considered
trying to create an extra bar for every activity, but that does not seem to work either

Additional context
thx for this amazing piece of software :)

@k1llerk3ks k1llerk3ks added the enhancement New feature or request label Dec 11, 2024
@k1llerk3ks
Copy link
Author

So, i tinkered around a bit. I have a solution that kind of works, but is just a workaround that works mostly.

I created a preset and chose to load this preset on any of those change options.
Before switching the activity, i replace the color string in the presetfile. then i switch -
If i have a window maximized on that screen, the color changes, if not, then it doesn't change. is there some possibility to resync/update the color? I suppose, some bus command is sent out from the plugin.

@luisbocanegra
Copy link
Owner

Supporting preset auto-loading based on the current activity should be possible, an example of a widget that uses them is Activity Pager or Task Manager https://github.com/KDE/plasma-desktop/blob/master/applets/taskmanager/package/contents/ui/ContextMenu.qml.

I already use org.kde.taskmanager to detect maximized/active window so it should be a matter of listing and linking presets to them in the presets auto-loading tab, then implement the detection and switch similar to existing ones.

For future reference here's an example of what presetAutoloading (https://github.com/luisbocanegra/plasma-panel-colorizer/blob/0b3fa70a665a69c073e3e20cdc05000e14251507/package/contents/config/main.xml#L40C15-L40C32) currently stores:

{
    "enabled": true,
    "maximized": "/home/luis/.config/panel-colorizer/presets/border",
    "touchingWindow": "/home/luis/.config/panel-colorizer/presets/border",
    "floating": "/home/luis/.config/panel-colorizer/presets/border",
    "normal": "/home/luis/.config/panel-colorizer/presets/border",
    "maximizedFilterByActive": true
}

Maybe activities could be added like this:

{
    "enabled": true,
    "maximized": "/home/luis/.config/panel-colorizer/presets/border",
    "touchingWindow": "/home/luis/.config/panel-colorizer/presets/border",
    "floating": "/home/luis/.config/panel-colorizer/presets/border",
    "normal": "/home/luis/.config/panel-colorizer/presets/border",
    "maximizedFilterByActive": true,
    "activity": {
        "activity-identifier-1": "/home/luis/.config/panel-colorizer/presets/border",
        "activity-identifier-2": "/home/luis/.config/panel-colorizer/presets/border"
    }
}

@luisbocanegra
Copy link
Owner

luisbocanegra commented Jan 9, 2025

This could be implemented by each widget exposing a D-Bus service using python, similar to what I did in https://github.com/luisbocanegra/plasma-cursor-eyes the difference would be that each panel need to be addressed in some way, possibly by creating separate service per panel unless there is a way to have a single service to talk to all the panels

luisbocanegra added a commit that referenced this issue Jan 11, 2025
Should be enabled first from the widget settings General tab

example usage:

qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset luisbocanegra.panel.colorizer.c337.w2346.preset /path/to/preset/dir

refs: #126
luisbocanegra added a commit that referenced this issue Jan 11, 2025
Should be enabled first from the widget settings General tab

example usage:

qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset luisbocanegra.panel.colorizer.c337.w2346.preset /path/to/preset/dir

refs: #126
luisbocanegra added a commit that referenced this issue Jan 11, 2025
Should be enabled first from the widget settings General tab

example usage:

qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset luisbocanegra.panel.colorizer.c337.w2346.preset /path/to/preset/dir

refs: #126
@luisbocanegra
Copy link
Owner

luisbocanegra commented Jan 11, 2025

Hi @k1llerk3ks, switching presets using the commandline with D-Bus has been added to dbus-service branch, can you check it out?

To update:

git clone https://github.com/luisbocanegra/plasma-panel-colorizer.git -b dbus-service
cd plasma-panel-colorizer
kpackagetool6 -t Plasma/Applet -u package

You may need to install the following packages if they aren't installed on your system

python-dbus python-gobject

After installing:

  1. Go to the widget settings

  2. In General tab enable the D-Bus service

  3. To apply a preset can use qdbus6 and pass the absolute path of a preset:

    qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset preset /path/to/preset/dir/

demo

Screencast_20250111_051948.webm

I thought about exposing individual configuration options (like color as you proposed) but decided not to as it would be too much work.

luisbocanegra added a commit that referenced this issue Jan 11, 2025
Should be enabled first from the widget settings General tab

example usage:

qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset luisbocanegra.panel.colorizer.c337.w2346.preset /path/to/preset/dir

refs: #126
luisbocanegra added a commit that referenced this issue Jan 12, 2025
Should be enabled first from the widget settings General tab

example usage:

qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset luisbocanegra.panel.colorizer.c337.w2346.preset /path/to/preset/dir

refs: #126
luisbocanegra added a commit that referenced this issue Jan 12, 2025
Should be enabled first from the widget settings General tab

example usage:

qdbus6 luisbocanegra.panel.colorizer.c337.w2346 /preset luisbocanegra.panel.colorizer.c337.w2346.preset /path/to/preset/dir

refs: #126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedbak needed
Projects
None yet
Development

No branches or pull requests

2 participants