Andeskjerf / waybar-module-pomodoro

A pomodoro timer intended for Waybar
The Unlicense
21 stars 3 forks source link

Menu on right click with adjustable config for timers #18

Open khushal-banks opened 2 days ago

khushal-banks commented 2 days ago

Depending on the planned tasks for the day:

This is already configurable using this module by adjusting command used to start waybar-module-pomodoro

If possible i personally want this configurable from a menu (not by adjusting waybar config) I tried to adjust UI portion for this feature like:

image

File Structure

$tree ~/.config/waybar ├── config
├── menus
│   └── waybar-module-pomodoro.xml
└── style.css

menus/waybar-module-pomodoro.xml

<?xml version="1.0" encoding="UTF-8"?>
<interface>
    <object class="GtkMenu" id="menu">
        <child>
            <object class="GtkMenuItem" id="start">
                <property name="label"> Start</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="stop">
                <property name="label"> Stop</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="toggle">
                <property name="label">󰐎 Toggle</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="reset">
                <property name="label"> Reset</property>
            </object>
        </child>
        <child>
            <object class="GtkSeparatorMenuItem" id="delimiter1"/>
        </child>
        <child>
            <object class="GtkMenuItem" id="timer2">
                <property name="label">󱑀 02 hr  25-05-05</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="timer2.5">
                <property name="label"> 2󱦒 hr  25-05-25</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="timer3">
                <property name="label">󱑁 03 hr  35-05-25</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="timer4">
                <property name="label">󱑂 04 hr  45-10-30</property>
            </object>
        </child>
        <child>
            <object class="GtkMenuItem" id="default">
                <property name="label">default  25-05-15</property>
            </object>
        </child>
    </object>
</interface>

waybar-config

    "custom/pomodoro": {
        "format": "{}",
        "return-type": "json",
        "exec": "waybar-module-pomodoro -p  -a  --autow --autob --autor --no-work-icons",
        "on-click": "waybar-module-pomodoro toggle",
        "menu": "on-click-right",
        "menu-file": "/home/caffrey/.config/waybar/menus/waybar-module-pomodoro.xml",
        "menu-actions": {
            "start": "waybar-module-pomodoro start",
            "stop": "waybar-module-pomodoro stop",
            "toggle": "waybar-module-pomodoro toggle",
            "reset": "waybar-module-pomodoro reset",
            "timer2": "waybar-module-pomodoro config -p  -a  --autow --autob --autor --no-work-icons -w 25 -b 5 -l 5",
            "timer2.5": "waybar-module-pomodoro config -p  -a  --autow --autob --autor --no-work-icons -w 25 -b 5 -l 25",
            "timer3": "waybar-module-pomodoro config -p  -a  --autow --autob --autor --no-work-icons -w 35 -b 5 -l 25",
            "timer4": "waybar-module-pomodoro config -p  -a  --autow --autob --autor --no-work-icons -w 45 -b 10 -l 30",
            "default": "waybar-module-pomodoro config -p  -a  --autow --autob --autor --no-work-icons",
        },
    },

I tried to implement config operation in the source code but failed because i am not proficient in rust programming language. I really want this feature though, if possible.

Can i expect this feature in upcoming release? Thank you for this amazing module.