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: allow setting a timer from the command line #227

Open
thomasvs opened this issue Apr 16, 2024 · 1 comment
Open

Feature request: allow setting a timer from the command line #227

thomasvs opened this issue Apr 16, 2024 · 1 comment
Labels

Comments

@thomasvs
Copy link

I have a script to start "flow mode" on my machine and would like to have a 90 minute timer started from this script using a cli.

@tatokis
Copy link
Member

tatokis commented Apr 16, 2024

For now, I came up with a really hacky solution:

First you need to find which alarm-X corresponds to the timer you want to enable. You do this by running something along the lines of dconf dump /io/github/alarm-clock-applet/ | grep -B 4 message and then looking at the [alarm-X] header.

Then, for example, for alarm-4 you can do in your script:

alarm_num=4

# Get duration of timer
alarm_time=$(gsettings get "io.github.alarm-clock-applet.alarm:/io/github/alarm-clock-applet/alarm-${alarm_num}/" time | sed 's@int64 @@')

# Schedule it
alarm_now=$(date +%s)
gsettings set "io.github.alarm-clock-applet.alarm:/io/github/alarm-clock-applet/alarm-${alarm_num}/" timestamp "$(($alarm_time + $alarm_now))"

# Enable it
gsettings set "io.github.alarm-clock-applet.alarm:/io/github/alarm-clock-applet/alarm-${alarm_num}/" active true

I will look into adding a command line option in the future that can do this in a proper way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants