Add pomodoro timer

This commit is contained in:
Jakob Lechner 2025-03-13 05:00:20 +01:00
parent 3bfe9a367e
commit e7f35b08fd
7 changed files with 436 additions and 0 deletions

View file

@ -22,6 +22,7 @@ in
myintercom-doorbell = callPackage ./myintercom-doorbell {
inherit poetry2nix;
};
pomodoro-timer = callPackage ./pomodoro-timer { };
pretix-banktool = callPackage ./pretix-banktool { };
tabbed-box-maker = callPackage ./tabbed-box-maker { };
vesc-firmware = callPackage ./vesc-tool/firmware.nix { };

View file

@ -0,0 +1,52 @@
{ lib
, stdenv
, yad
, uair
, gnused
, writeShellScript
, makeDesktopItem
}:
let
pomodoroTimer = writeShellScript "pomodoro-timer" ''
export PATH=${lib.makeBinPath [yad uair gnused]}
uairctl listen -o yad \
| yad \
--title="Pomodoro" \
--geometry="300x50" \
--scale \
--progress \
--no-buttons \
--css="* { font-size: 60px;} progress { min-height: 1200px; margin: -100px -8px -6px;}"
'';
in
stdenv.mkDerivation rec {
pname = "pomodoro-timer";
version = "1.0.0";
src = ./pomodorotimer.svg;
dontUnpack = true;
installPhase = ''
dir=$out/share/icons/hicolor/scalable/apps/
mkdir -p $dir
cp $src $dir/pomodorotimer.svg
mkdir $out/bin
cp "${pomodoroTimer}" $out/bin/pomodoro-timer
ln -s "${desktopItem}/share/applications" $out/share/
'';
desktopItem = makeDesktopItem {
name = pname;
exec = pname;
icon = "pomodorotimer";
desktopName = pname;
comment = meta.description;
categories = [ "Utility" ];
};
meta = with lib; {
description = "Pomodoro timer (GUI for uair)";
maintainers = with maintainers; [ jalr ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,274 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:ns1="http://sozi.baierouge.fr"
id="svg3215"
sodipodi:docname="lmproulx_Timer_Minuterie.svg"
inkscape:export-filename="/home/fairhonanth/Downloads/pomodoro_technique.png"
viewBox="0 0 167.68 202.13"
sodipodi:version="0.32"
inkscape:export-xdpi="90"
version="1.0"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-ydpi="90"
inkscape:version="0.48.1 r9760"
>
<sodipodi:namedview
id="base"
bordercolor="#666666"
inkscape:pageshadow="2"
inkscape:window-y="-3"
pagecolor="#ffffff"
inkscape:window-height="1033"
inkscape:window-maximized="1"
inkscape:zoom="2.8"
inkscape:window-x="-2"
showgrid="false"
borderopacity="1.0"
inkscape:current-layer="g3008"
inkscape:cx="197.61853"
inkscape:cy="91.54331"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:pageopacity="0.0"
inkscape:document-units="px"
/>
<g
id="layer1"
inkscape:label="Calque 1"
inkscape:groupmode="layer"
transform="translate(-283.34 -77.544)"
>
<g
id="g3008"
>
<path
id="path2999"
style="stroke:#000000;stroke-width:1px;fill:none"
sodipodi:revolution="2.7753501"
sodipodi:radius="65.967102"
d="m-39.506 77.552c11.571-31.11 47.723-45.869 78.299-34.282 14.094 5.341 25.984 15.725 33.35 28.856"
transform="matrix(1.1487 0 0 1.2103 350.02 113.29)"
sodipodi:argument="-17.892002"
sodipodi:cy="101.05466"
sodipodi:cx="12.857142"
sodipodi:expansion="1"
sodipodi:type="spiral"
sodipodi:t0="0.87006927"
/>
<path
id="path4572"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csssssssc"
style="stroke-linejoin:round;fill-opacity:.99219;stroke:#000000;stroke-linecap:round;stroke-width:2.011;fill:#d40000"
d="m449.94 197.88c0 22.628-7.3862 38.252-22.537 54.887-11.298 12.405-26.476 24.055-44.604 24.968-5.1475 0.25934-10.321 1.1822-15.66 0.86288-22.065-1.3197-42.368-9.4447-55.488-22.143-16.403-15.876-27.313-35.122-27.313-58.575 0-45.419 37.35-77.455 82.801-78.114 29.176-0.42336 58.79 15.442 72.656 34.475 8.4962 11.662 10.145 28.075 10.145 43.639z"
/>
<path
id="path4574"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
d="m284.34 209.34c63.979 6.1975 115.83 6.4569 166.12-2.6038"
/>
<path
id="path4578"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ececec"
inkscape:connector-curvature="0"
d="m300.85 193.43v17.318"
/>
<path
id="path4580"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m332.95 191.5v20.395"
/>
<path
id="path4582"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m350.2 203.38-0.15254 9.6048"
/>
<path
id="path4584"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m383.62 202.35v10.936"
/>
<path
id="path4586"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m367.97 191.05v22.42"
/>
<path
id="path4588"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m397.35 190.26v22.132"
/>
<path
id="path4590"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m414.87 201.24v10.098"
/>
<path
id="path4592"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m428.14 188.39 0.52076 21.094"
/>
<path
id="path4598"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.033;fill:#008000"
d="m345.64 132.18c12.771 6.5096 27.469 6.9317 36.906 1.2618 18.887-10.337 30.124-25.584 40.147-39.003-11.189 6.7213-22.089 21.195-39.312 21.928 11.016-10.681 6.8429-27.125 5.0322-37.806-5.1285 9.9873-10.221 25.738-16.983 35.725-11.579-2.4118-14.723-12.224-16.354-17.927-6.5197 5.6872-4.6926 15.985-1.258 21.672-18.102-3.5138-29.798-23.656-39.941-34.541 5.1651 15.036 8.3952 36.474 31.764 48.69z"
/>
<path
id="path4679"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.011;fill:#ffffff"
d="m368.18 219.25-13.993 17.675c8.5921 2.5458 17.184 2.8051 25.776 0l-11.79-17.67z"
/>
<path
id="path3269"
style="stroke-linejoin:round;fill-opacity:.99219;stroke:#000000;stroke-linecap:round;stroke-width:.484;fill:#ffffff"
inkscape:connector-curvature="0"
d="m366.99 183.8v2.4574h-13.637c-0.0188-0.61553 0.0797-1.2074 0.29554-1.7756 0.34713-0.93752 0.90067-1.8608 1.6606-2.77 0.76933-0.90912 1.8764-1.9603 3.3212-3.1535 2.2423-1.8561 3.7575-3.324 4.5456-4.4036 0.78807-1.089 1.1821-2.1165 1.1821-3.0825 0-1.0132-0.36124-1.8656-1.0836-2.5569-0.71305-0.70074-1.6466-1.0511-2.8006-1.0512-1.2197 0.00002-2.1954 0.36935-2.9272 1.108-0.7318 0.73866-1.1024 1.7614-1.1118 3.0683l-2.6035-0.26986c0.17827-1.9603 0.84907-3.4518 2.0124-4.4746 1.1634-1.0322 2.7255-1.5483 4.6863-1.5483 1.9796 0.00003 3.5464 0.55404 4.7004 1.662s1.731 2.4811 1.731 4.1194c0 0.83337-0.16886 1.6525-0.5066 2.4575-0.33777 0.80494-0.90069 1.6525-1.6888 2.5427-0.77873 0.89019-2.0782 2.1118-3.8982 3.6649-1.5199 1.2879-2.4957 2.1639-2.9272 2.6279-0.43158 0.45455-0.7881 0.91385-1.0696 1.3779h10.119m2.7302-2.9973 2.6598-0.22727c0.19703 1.3069 0.65206 2.2918 1.3651 2.9546 0.72242 0.65343 1.5903 0.98016 2.6035 0.98016 1.2197 0 2.2517-0.46404 3.0961-1.3921 0.84439-0.92807 1.2666-2.1592 1.2666-3.6933 0-1.4584-0.4081-2.609-1.2243-3.4518-0.80687-0.84281-1.867-1.2642-3.1805-1.2642-0.81625 0-1.5527 0.18942-2.2095 0.56819-0.65676 0.36935-1.1728 0.85231-1.548 1.4489l-2.3784-0.31253 1.9984-10.696h10.259v2.4433h-8.2328l-1.1118 5.5968c1.2384-0.87123 2.5378-1.3069 3.8983-1.3069 1.8014 0 3.3212 0.62976 4.5597 1.8893 1.2384 1.2595 1.8576 2.8789 1.8576 4.8581 0 1.8845-0.54416 3.5134-1.6325 4.8865-1.3229 1.6856-3.1289 2.5285-5.4181 2.5285-1.8764 0-3.4104-0.53031-4.6019-1.591-1.1822-1.0606-1.8576-2.4669-2.0265-4.2189"
/>
<path
id="path3271"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m317.26 201.56-0.15254 9.6048"
/>
<path
id="path3273"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.105;fill:#ffffff"
inkscape:connector-curvature="0"
d="m442.45 197.27v10.098"
/>
<text
id="text3001"
sodipodi:linespacing="125%"
style="stroke-width:.3;font-size:40px;letter-spacing:0px;line-height:125%;word-spacing:0px;stroke:#000000;font-family:Sans;fill:#ffffff"
xml:space="preserve"
transform="matrix(.94370 .33081 -.33081 .94370 97.475 -118.04)"
>
<textPath
id="textPath3005"
style="font-size:15px;stroke:#000000;stroke-width:.3;fill:#ffffff"
xlink:href="#path2999"
>Pomodoro Timer</textPath
>
</text
>
</g
>
</g
>
<metadata
>
<rdf:RDF
>
<cc:Work
>
<dc:format
>image/svg+xml</dc:format
>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
/>
<dc:publisher
>
<cc:Agent
rdf:about="http://openclipart.org/"
>
<dc:title
>Openclipart</dc:title
>
</cc:Agent
>
</dc:publisher
>
<dc:title
>Pomodoro Timer</dc:title
>
<dc:date
>2011-05-03T21:58:11</dc:date
>
<dc:description
>The Pomodoro Technique® is a way to get the most out of time management. Develop by Francesco Cirillo.</dc:description
>
<dc:source
>https://openclipart.org/detail/135631/pomodoro-timer-by-fairhonanth</dc:source
>
<dc:creator
>
<cc:Agent
>
<dc:title
>fairhonanth</dc:title
>
</cc:Agent
>
</dc:creator
>
<dc:subject
>
<rdf:Bag
>
<rdf:li
>management</rdf:li
>
<rdf:li
>pomodoro</rdf:li
>
<rdf:li
>productivity</rdf:li
>
<rdf:li
>techinique</rdf:li
>
<rdf:li
>timer</rdf:li
>
</rdf:Bag
>
</dc:subject
>
</cc:Work
>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"
>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/>
</cc:License
>
</rdf:RDF
>
</metadata
>
</svg
>

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -28,6 +28,7 @@
./openscad.nix
./ots.nix
./pass.nix
./pomodoro.nix
./python.nix
./remarkable
./snapclient.nix

View file

@ -0,0 +1,69 @@
{ nixosConfig, lib, pkgs, config, ... }:
let
tomlFormat = pkgs.formats.toml { };
in
lib.mkIf nixosConfig.jalr.gui.enable {
home.packages = with pkgs; [
uair
pomodoro-timer
];
xdg.configFile."uair/uair.toml".source = tomlFormat.generate "uair.toml" {
defaults = {
loop_on_end = true;
paused_state_text = "paused";
resumed_state_text = "resumed";
overrides = {
yad = {
format = "{percent}\n#{time}\n";
};
json = {
format = ''{"name": "{name}", "percent": {percent}", "time": "{time}", "running": {state}, "total": "{total}"}
'';
paused_state_text = "false";
resumed_state_text = "true";
};
waybar = {
format = ''{"text": "{name}: {time}", "class": "{state}"}
'';
paused_state_text = "paused";
resumed_state_text = "resumed";
};
};
};
sessions =
let
work-finished = "notify-send 'Pomodoro done! Enjoy your break.'; dnd off";
break-finished = "notify-send 'Get back to work!'; dnd on";
in
[
{ name = "Work 1"; duration = "25m"; command = work-finished; }
{ name = "Break 1"; duration = "5m"; command = break-finished; }
{ name = "Work 2"; duration = "25m"; command = work-finished; }
{ name = "Break 2"; duration = "5m"; command = break-finished; }
{ name = "Work 3"; duration = "25m"; command = work-finished; }
{ name = "Break 3"; duration = "5m"; command = break-finished; }
{ name = "Work 4"; duration = "25m"; command = work-finished; }
{ name = "Long Break"; duration = "20m"; command = break-finished; }
];
};
systemd.user.services.uair = {
Unit.Description = "Pomodoro timer";
Service = {
ExecStart = "${pkgs.uair}/bin/uair";
NoNewPrivileges = true;
ProtectControlGroups = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX";
RestrictNamespaces = true;
Type = "simple";
Environment = [
"PATH=/etc/profiles/per-user/jalr/bin:/run/current-system/sw/bin/"
];
};
Install.WantedBy = [ "default.target" ];
};
}

View file

@ -293,6 +293,13 @@ in
};
command = "floating enable";
}
{
criteria = {
app_id = "yad";
title = "Pomodoro";
};
command = "floating enable";
}
];
window.border = 2;

View file

@ -41,6 +41,7 @@ in
"custom/screencast"
"custom/redshift"
"idle_inhibitor"
"custom/pomodoro"
"backlight"
"pulseaudio"
"network"
@ -71,6 +72,32 @@ in
format = "󰌵";
tooltip = false;
};
"custom/pomodoro" = let uairctl = "${pkgs.uair}/bin/uairctl"; in {
# We need to remove nul-characters
# See https://github.com/metent/uair/issues/15
exec = pkgs.writeShellScript "uairctl-without-null-characters" ''
${uairctl} listen -o waybar | ${pkgs.gnused}/bin/sed --unbuffered 's/\x0//g'
'';
on-click = "${uairctl} toggle";
on-scroll-up = "${uairctl} next";
on-scroll-down = "${uairctl} prev";
on-click-middle = "${uairctl} finish";
menu = "on-click-right";
/*
menu-actions = {
"work 1" = "${uairctl} jump 0";
"break 1" = "${uairctl} jump 1";
"work 2" = "${uairctl} jump 2";
"break 2" = "${uairctl} jump 3";
"work 3" = "${uairctl} jump 4";
"break 3" = "${uairctl} jump 5";
"work 4" = "${uairctl} jump 6";
"long break" = "${uairctl} jump 7";
};
*/
return-type = "json";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
@ -362,6 +389,11 @@ in
animation-iteration-count: infinite;
animation-direction: alternate;
}
#custom-pomodoro.resumed {
color: @base01;
background-color: @base0B;
}
'';
systemd.user.services.waybar = {