add toggl track timer to xmobar

This commit is contained in:
Horhik 2021-03-22 20:03:52 +03:00
parent 5f0b757f25
commit 4012e1cc29
4 changed files with 40 additions and 4 deletions

View 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

View File

@ -101,7 +101,18 @@ calendar ()
{
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 "                                          "

View File

@ -99,6 +99,17 @@ calendar ()
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 "                                          "

View File

@ -387,7 +387,7 @@ myLogHook (xmproc0, xmproc1) = dynamicLogWithPP $ xmobarPP { -- XMobar
myStartupHook = do
spawnOnce "nitrogen --restore &"
-- spawnOnce "compton --config ~/.config/compton/compton.conf &"
spawnOnce "picom &"
spawnOnce "picom --experimental-backends &"
spawnOnce "deadd-notification-center &"
spawnOnce "setxkbmap us,ru &"
spawnOnce "sh ssh-agent bash ; ssh-add ~/.ssh/arch"
@ -396,8 +396,9 @@ myStartupHook = do
spawnOnce ("xrandr --output HDMI1 --above eDP1&")
spawnOnce (home ++ ".local/scripts/status/launch &")
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 "eval '$(ssh-agent -s)'; ssh-add ~/.ssh/id_rsa &"
spawnOnce "sleep 10; pulseaudio -k"
------------------------------------------------------------------------