mirror of
https://github.com/Horhik/dotfiles.git
synced 2025-01-08 00:31:04 +00:00
add toggl track timer to xmobar
This commit is contained in:
parent
5f0b757f25
commit
4012e1cc29
13
home/scripts/.local/scripts/toggl-current
Executable file
13
home/scripts/.local/scripts/toggl-current
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#your toggl api token
|
||||||
|
TOGGL_API_TOKEN= #here
|
||||||
|
res=$(curl -u $TOGGL_API_TOKEN:api_token \
|
||||||
|
-X GET https://api.track.toggl.com/api/v8/time_entries/current)
|
||||||
|
echo $res
|
||||||
|
|
||||||
|
# desc=$(echo $res | jq -r '.data .description')
|
||||||
|
# dur=$(echo $res | jq -r '.data .duration')
|
||||||
|
#
|
||||||
|
# echo $desc
|
||||||
|
# echo $dur
|
|
@ -101,7 +101,18 @@ calendar ()
|
||||||
{
|
{
|
||||||
echo "<fc=$greenDarkerColor> </fc>"$(date +'%d/%m/%Y')
|
echo "<fc=$greenDarkerColor> </fc>"$(date +'%d/%m/%Y')
|
||||||
}
|
}
|
||||||
|
toggl_timer () {
|
||||||
|
toggl=$($HOME/.local/scripts/toggl-current)
|
||||||
|
toggl_duration=$(echo $toggl | jq -r '.data .duration')
|
||||||
|
toggl_description=$(echo $toggl | jq -r '.data .description')
|
||||||
|
curr_time=$(date +%s)
|
||||||
|
duration_sec=$((curr_time + toggl_duration))
|
||||||
|
duration=$(echo $((duration_sec / (60 * 60))):$((duration_sec / 60 - duration_sec / (60 * 60) * 60)):$((duration_sec % 60)))
|
||||||
|
echo "<fc=$greenDarkerColor>—{$toggl_description(</fc>"$duration"<fc=$greenDarkerColor>)}</fc>"
|
||||||
|
}
|
||||||
|
|
||||||
echo "$(wifi)$(battery)$(volume)$(layout)$(diskspace)$(timeanddate)<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}—-</fc>"
|
|
||||||
|
|
||||||
|
echo "$(toggl_timer)$(wifi)$(battery)$(volume)$(layout)$(diskspace)$(timeanddate)<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}—-</fc>"
|
||||||
|
|
||||||
#echo " "
|
#echo " "
|
||||||
|
|
|
@ -99,6 +99,17 @@ calendar ()
|
||||||
echo "<fc=$greenDarkerColor> </fc>"$(date +'%d/%m/%Y')
|
echo "<fc=$greenDarkerColor> </fc>"$(date +'%d/%m/%Y')
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "$(wifi)$(battery)$(volume)$(layout)$(diskspace)$(timeanddate)<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}——</fc>"
|
toggl_timer () {
|
||||||
|
toggl=$($HOME/.local/scripts/toggl-current)
|
||||||
|
toggl_duration=$(echo $toggl | jq -r '.data .duration')
|
||||||
|
toggl_description=$(echo $toggl | jq -r '.data .description')
|
||||||
|
curr_time=$(date +%s)
|
||||||
|
duration_sec=$((curr_time + toggl_duration))
|
||||||
|
duration=$(echo $((duration_sec / (60 * 60))):$((duration_sec / 60 - duration_sec / (60 * 60) * 60)):$((duration_sec % 60)))
|
||||||
|
echo "<fc=$greenDarkerColor>—{$toggl_description(</fc>"$duration"<fc=$greenDarkerColor>)}</fc>"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "$(toggl_timer)$(wifi)$(battery)$(volume)$(layout)$(diskspace)$(timeanddate)<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}——</fc>"
|
||||||
|
|
||||||
#echo " "
|
#echo " "
|
||||||
|
|
|
@ -387,7 +387,7 @@ myLogHook (xmproc0, xmproc1) = dynamicLogWithPP $ xmobarPP { -- XMobar
|
||||||
myStartupHook = do
|
myStartupHook = do
|
||||||
spawnOnce "nitrogen --restore &"
|
spawnOnce "nitrogen --restore &"
|
||||||
-- spawnOnce "compton --config ~/.config/compton/compton.conf &"
|
-- spawnOnce "compton --config ~/.config/compton/compton.conf &"
|
||||||
spawnOnce "picom &"
|
spawnOnce "picom --experimental-backends &"
|
||||||
spawnOnce "deadd-notification-center &"
|
spawnOnce "deadd-notification-center &"
|
||||||
spawnOnce "setxkbmap us,ru &"
|
spawnOnce "setxkbmap us,ru &"
|
||||||
spawnOnce "sh ssh-agent bash ; ssh-add ~/.ssh/arch"
|
spawnOnce "sh ssh-agent bash ; ssh-add ~/.ssh/arch"
|
||||||
|
@ -396,8 +396,9 @@ myStartupHook = do
|
||||||
spawnOnce ("xrandr --output HDMI1 --above eDP1&")
|
spawnOnce ("xrandr --output HDMI1 --above eDP1&")
|
||||||
spawnOnce (home ++ ".local/scripts/status/launch &")
|
spawnOnce (home ++ ".local/scripts/status/launch &")
|
||||||
spawnOnce (home ++ ".local/scripts/touchpad.sh &")
|
spawnOnce (home ++ ".local/scripts/touchpad.sh &")
|
||||||
spawnOnce ("cd /home/horhik/Freenet/downloads/fms; ./fms --daemon &")
|
-- spawnOnce ("cd /home/horhik/Freenet/downloads/fms; ./fms --daemon &")
|
||||||
spawnOnce "xautolock -time 25 -locker i3lock-fancy-multimonitor -notifier 'xkb-switch -s us' &"
|
spawnOnce "xautolock -time 25 -locker i3lock-fancy-multimonitor -notifier 'xkb-switch -s us' &"
|
||||||
|
spawnOnce "eval '$(ssh-agent -s)'; ssh-add ~/.ssh/id_rsa &"
|
||||||
spawnOnce "sleep 10; pulseaudio -k"
|
spawnOnce "sleep 10; pulseaudio -k"
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue