-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add multi-purpose customizable widgets fo wf-panel #86
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 460e44c. Should had been made in another branch…
Sorry… (branching mistake) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long delay, looks good overall, and makes for an interesting widget.
@@ -194,6 +195,8 @@ class WayfirePanel::impl | |||
return Widget(new WayfireMenu()); | |||
if (name == "launchers") | |||
return Widget(new WayfireLaunchers()); | |||
if (name == "custom") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom
sounds quite generic to me. Maybe custom-buttons
?
|
||
WfCustomizableButton::WfCustomizableButton() | ||
{ | ||
/* I tried to set these as class variables (static), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wf-options need to be created after loading the config file, which happens before widgets are initialized, but it won't work before that :)
{ | ||
info->execute(ev->button); | ||
} | ||
if (ev->button == 1 && ev->type == GDK_BUTTON_PRESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem to be doing anything, maybe we should remove it?
std::string output; | ||
if (info->cmd_tooltip.length() > 0) | ||
{ | ||
info->execute(info->cmd_tooltip, &output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cool idea, hadn't thought about it, +1
what about
something similar to polybar modules where you can specify a command to calculate the text by running a command repeatedly. I also think you could have a customizables section this in my opinion improves readability and they could possibly be implemented into the dock as well |
@@ -189,5 +189,20 @@ | |||
<default>2.5</default> | |||
</option> | |||
</group> | |||
<group> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for your work here. I wonder if this will include a tray or make it possible? I did want to comment on one thing I noticed:
The style for the xml files isn't enforced by CI, but I would like to see whitespace style consistency. Here, tabs should be used, not spaces.
Hi,
This PR adds multi-purpose customizable widgets to wf-panel:
These are merely 'super'-launchers with a basic widget look (button-like, no animation) and dedicated commands for mouse button/srolll actions and tooltip.
I made this to fit my needs but I hope it can be useful to other wf-shell users as well; it may also be a workaround to issue #22.
Configuration (in wf-shell.ini):
customizables_size = <int>
customizables_spacing = <int>
customizables_invert = <bool>
custom_label_<name> = <string>
(mandatory)custom_icon_<name> = <string>
custom_btn[1-3]_cmd_<name> = <string>
custom_scr_[up|dn]_cmd_<name> = <string>
custom_tooltip_cmd_<name> = <string>
Important note about custom_tooltip_cmd:
This spawns a synchronous command, therefore waits for it to exit; so be careful with this command.
Configuration example:
customizables_size = 16
customizables_spacing = 2
customizables_invert = true
custom_label_1 = mpc
custom_icon_1 = /usr/share/icons/Adwaita/16x16/emblems/emblem-music-symbolic.symbolic.png
custom_btn1_cmd_1 = mpc toggle
custom_btn2_cmd_1 = mpc consume
custom_btn3_cmd_1 = sonata
custom_scr_up_cmd_1 = mpc seek -00:00:10
custom_scr_dn_cmd_1 = mpc seek +00:00:10
custom_tooltip_cmd_1 = mpc current
custom_label_2 = backlight
custom_icon_2 = /usr/share/icons/Adwaita/16x16/devices/video-display-symbolic.symbolic.png
custom_btn1_cmd_2 = brightnessctl --device=intel_backlight set 1
custom_btn2_cmd_2 = killall kanshi || /usr/bin/kanshi
custom_btn3_cmd_2 = wdisplays
custom_scr_up_cmd_2 = brightnessctl --device=intel_backlight set +1%
custom_scr_dn_cmd_2 = brightnessctl --device=intel_backlight set 1%-
custom_tooltip_cmd_2 = brightnessctl --device=intel_backlight --machine-readable info | cut -d, -f4
Coding notes:
I initially tried to inherit from Launchers but got stuck by LauncherInfo pure abstract struct; then I had either to modify the related code, or create new (well, it's almost a copy of Launchers…) dedicated struct/class and let mainteners decide which way is better ;-).
I tried to follow coding style and indentation found in other files but I may have missed some things.
It has been quite a while I haven't programmed in C++ and I've learnt a lot by reading the existing code and making this!
Many thanks to Wayfire contributors for this great WM!
Cheers!