diff --git a/.config/sway/config b/.config/sway/config index de28c21..102f5cd 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -187,7 +187,7 @@ bindsym $mod+r mode "resize" bar { position top - status_command i3status + status_command ~/.config/sway/i3status-wrapper status_edge_padding 6 status_padding 0 diff --git a/.config/sway/i3status-wrapper b/.config/sway/i3status-wrapper new file mode 100755 index 0000000..a23f63f --- /dev/null +++ b/.config/sway/i3status-wrapper @@ -0,0 +1,15 @@ +#!/bin/sh + +. ~/.profile + +i3status | while true; do + read line + json_array="$(echo $line | grep -F [{ | sed -e 's/^,//')" + if test -z "$json_array"; then + echo "$line" + else + zeit_obj='{"name":"zeit","instance":"zeit","markup":"none","full_text":"'"$(zeit tracking)"'"}' + json_array="$(echo $json_array | jq ". |= [$zeit_obj] + .")" + echo "$json_array," + fi +done diff --git a/.local/bin/zeit-fuzzel b/.local/bin/zeit-fuzzel new file mode 100755 index 0000000..d5a4e17 --- /dev/null +++ b/.local/bin/zeit-fuzzel @@ -0,0 +1,24 @@ +#!/bin/sh +# Forked from https://github.com/mrusme/zeit/blob/c07a40a3185091dda8ba9a3b81c1e017bfda609b/extras/zeit-waybar-wofi.sh + +tracking="$(zeit tracking --no-colors)" + +if echo "$tracking" | grep -q '^ ▶ tracking'; then + zeit finish + exit 0 +fi + +selection="$(zeit list \ + --only-projects-and-tasks \ + --append-project-id-to-task \ + | fuzzel-run \ + --dmenu +)" + +task="$(echo $selection | pcregrep -io1 '└── (.+) \[.+')" +project="$(echo $selection | pcregrep -io1 '.+\[(.+)\]')" +if test "$task" = "" || "$project" = ""; then + exit 1 +fi + +zeit track -p "$project" -t "$task" diff --git a/.local/share/applications/zeit-fuzzel.desktop b/.local/share/applications/zeit-fuzzel.desktop new file mode 100644 index 0000000..425e076 --- /dev/null +++ b/.local/share/applications/zeit-fuzzel.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Version=1.0 +Name=toggle zeit time tracking +Exec=zeit-fuzzel +Terminal=false +Type=Application diff --git a/.profile b/.profile index 9e023e9..947c9a4 100755 --- a/.profile +++ b/.profile @@ -7,6 +7,8 @@ ulimit -c unlimited export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/go/bin:$PATH" +export ZEIT_DB=~/Sync/zeit.db + export EDITOR=vis export FZF_DEFAULT_OPTS='--color=light'