diff options
author | Yigit Sever | 2021-10-31 16:29:10 +0300 |
---|---|---|
committer | Yigit Sever | 2021-10-31 16:29:10 +0300 |
commit | 7d02d49ee5dd8c43b72cd50cd00a6e9de79f74ed (patch) | |
tree | 6d4f202b6612bebf5c770536e6ed8a2a0481163f /.config/polybar | |
parent | a0d0369640dbdf7aa64009556bc23e6252dfbb4c (diff) | |
download | dotfiles-7d02d49ee5dd8c43b72cd50cd00a6e9de79f74ed.tar.gz dotfiles-7d02d49ee5dd8c43b72cd50cd00a6e9de79f74ed.tar.bz2 dotfiles-7d02d49ee5dd8c43b72cd50cd00a6e9de79f74ed.zip |
polybar: iss tracker (spaaaace)
Diffstat (limited to '.config/polybar')
-rw-r--r-- | .config/polybar/config##h.maus | 62 | ||||
-rwxr-xr-x | .config/polybar/launch.sh | 15 | ||||
-rwxr-xr-x | .config/polybar/scripts/space | 31 |
3 files changed, 54 insertions, 54 deletions
diff --git a/.config/polybar/config##h.maus b/.config/polybar/config##h.maus index cf390c7..15e98ac 100644 --- a/.config/polybar/config##h.maus +++ b/.config/polybar/config##h.maus | |||
@@ -23,20 +23,6 @@ purple = #7F21AD | |||
23 | aqua = #4CC9BE | 23 | aqua = #4CC9BE |
24 | orange = #C24049 | 24 | orange = #C24049 |
25 | 25 | ||
26 | ; [colors] | ||
27 | ; background = #080808 | ||
28 | ; background_modules = #eeeeee | ||
29 | ; foreground = #b2b2b2 | ||
30 | ; foreground_modules = #080808 | ||
31 | ; red = #ff5454 | ||
32 | ; green = #8cc85f | ||
33 | ; sold_out_green = #1DB954 | ||
34 | ; yellow = #e3c78a | ||
35 | ; blue = #80a0ff | ||
36 | ; purple = #d183e8 | ||
37 | ; aqua = #79dac8 | ||
38 | ; orange = #ff5189 | ||
39 | |||
40 | [bar/top] | 26 | [bar/top] |
41 | monitor = DP-0 | 27 | monitor = DP-0 |
42 | width = 100% | 28 | width = 100% |
@@ -45,6 +31,7 @@ offset-x = 0 | |||
45 | offset-y = 0 | 31 | offset-y = 0 |
46 | radius = 0 | 32 | radius = 0 |
47 | fixed-center = true | 33 | fixed-center = true |
34 | enable-ipc = true | ||
48 | 35 | ||
49 | background = ${colors.background} | 36 | background = ${colors.background} |
50 | foreground = ${colors.foreground} | 37 | foreground = ${colors.foreground} |
@@ -55,7 +42,7 @@ module-margin = 1 | |||
55 | font-0 = scientifica:antialias=false;1 | 42 | font-0 = scientifica:antialias=false;1 |
56 | font-1 = Siji:size=20;1 | 43 | font-1 = Siji:size=20;1 |
57 | 44 | ||
58 | modules-left = i3 pulseaudio-control spotify mpd github | 45 | modules-left = i3 pulseaudio-control spotify mpd github iss |
59 | modules-center = xwindow | 46 | modules-center = xwindow |
60 | modules-right = focus notification_pause memory cpu download upload date time | 47 | modules-right = focus notification_pause memory cpu download upload date time |
61 | 48 | ||
@@ -87,15 +74,20 @@ format-prefix-padding = 1 | |||
87 | format-offline = <label-offline> | 74 | format-offline = <label-offline> |
88 | label-offline = Github offline | 75 | label-offline = Github offline |
89 | 76 | ||
77 | [module/iss] | ||
78 | type = custom/script | ||
79 | exec = /home/yigit/.config/polybar/scripts/space | ||
80 | interval = 5 | ||
81 | |||
90 | [module/focus] | 82 | [module/focus] |
91 | type = custom/script | 83 | type = custom/script |
92 | exec = ~/.config/polybar/scripts/focus | 84 | exec = /home/yigit/.config/polybar/scripts/focus |
93 | double-click-left = exec ~/.config/polybar/scripts/stop & | 85 | double-click-left = exec /home/yigit/.config/polybar/scripts/stop & |
94 | interval = 1 | 86 | interval = 10 |
95 | 87 | ||
96 | [module/notification_pause] | 88 | [module/notification_pause] |
97 | type = custom/script | 89 | type = custom/script |
98 | exec = ~/.config/polybar/scripts/notification_pause | 90 | exec = /home/yigit/.config/polybar/scripts/notification_pause |
99 | interval = 5 | 91 | interval = 5 |
100 | 92 | ||
101 | [module/spotify] | 93 | [module/spotify] |
@@ -109,7 +101,6 @@ format-prefix-foreground = ${colors.foreground_modules} | |||
109 | format = <label> | 101 | format = <label> |
110 | format-padding = 0 | 102 | format-padding = 0 |
111 | exec = python /usr/share/polybar/scripts/spotify_status.py -f '{play_pause} {artist} - {song}' -p ', ' | 103 | exec = python /usr/share/polybar/scripts/spotify_status.py -f '{play_pause} {artist} - {song}' -p ', ' |
112 | ;契 | ||
113 | 104 | ||
114 | [module/mpd] | 105 | [module/mpd] |
115 | type = internal/mpd | 106 | type = internal/mpd |
@@ -329,39 +320,18 @@ label-background = ${colors.background_modules} | |||
329 | label-foreground = ${colors.foreground_modules} | 320 | label-foreground = ${colors.foreground_modules} |
330 | label-padding = 1 | 321 | label-padding = 1 |
331 | 322 | ||
332 | [module/pulseaudio] | ||
333 | type = internal/pulseaudio | ||
334 | interval = 5 | ||
335 | |||
336 | format-volume = <label-volume> | ||
337 | |||
338 | format-volume-prefix = | ||
339 | format-volume-prefix-background = ${colors.purple} | ||
340 | format-volume-prefix-foreground = ${colors.background_modules} | ||
341 | format-volume-prefix-padding = 1 | ||
342 | |||
343 | label-volume = %percentage% | ||
344 | label-volume-background = ${colors.background_modules} | ||
345 | label-volume-foreground = ${colors.foreground_modules} | ||
346 | label-volume-padding = 1 | ||
347 | |||
348 | label-muted = | ||
349 | label-muted-background = ${colors.purple} | ||
350 | label-muted-foreground = ${colors.foreground} | ||
351 | label-muted-padding = 2 | ||
352 | |||
353 | [module/pulseaudio-control] | 323 | [module/pulseaudio-control] |
354 | type = custom/script | 324 | type = custom/script |
355 | tail = true | 325 | tail = true |
356 | label = %output% | 326 | label = %output% |
357 | interval = 5 | 327 | interval = 5 |
358 | 328 | ||
359 | exec = ~/.config/polybar/scripts/pulseaudio_control --listen | 329 | exec = /home/yigit/.config/polybar/scripts/pulseaudio_control --listen |
360 | click-right = exec pavucontrol & | 330 | click-right = exec pavucontrol & |
361 | click-left = ~/.config/polybar/scripts/pulseaudio_control --togmute | 331 | click-left = /home/yigit/.config/polybar/scripts/pulseaudio_control --togmute |
362 | click-middle = ~/.config/polybar/scripts/pulseaudio_control --change | 332 | click-middle = /home/yigit/.config/polybar/scripts/pulseaudio_control --change |
363 | scroll-up = ~/.config/polybar/scripts/pulseaudio_control --up | 333 | scroll-up = /home/yigit/.config/polybar/scripts/pulseaudio_control --up |
364 | scroll-down = ~/.config/polybar/scripts/pulseaudio_control --down | 334 | scroll-down = /home/yigit/.config/polybar/scripts/pulseaudio_control --down |
365 | label-padding = 2 | 335 | label-padding = 2 |
366 | label-foreground = ${colors.foreground_modules} | 336 | label-foreground = ${colors.foreground_modules} |
367 | label-background = ${colors.background_modules} | 337 | label-background = ${colors.background_modules} |
diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index 0f657c9..1e94ee3 100755 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh | |||
@@ -1,15 +1,14 @@ | |||
1 | #!/bin/bash | 1 | #!/usr/bin/env bash |
2 | |||
3 | # Try your luck one last time | ||
4 | # fc-cache -fv | ||
5 | 2 | ||
6 | # Terminate already running bar instances | 3 | # Terminate already running bar instances |
7 | killall -q polybar | 4 | # killall -q polybar |
8 | 5 | ||
9 | # Wait until the processes have been shut down | 6 | # If all your bars have ipc enabled, you can also use |
10 | while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done | 7 | polybar-msg cmd quit |
11 | 8 | ||
12 | # Launch bar | 9 | # Launch bar |
13 | polybar top & | 10 | # Launch bar1 and bar2 |
11 | echo "---" | tee -a /tmp/polybar.top.log | ||
12 | polybar top 2>&1 | tee -a /tmp/polybar.top.log & disown | ||
14 | 13 | ||
15 | echo "Bar launched..." | 14 | echo "Bar launched..." |
diff --git a/.config/polybar/scripts/space b/.config/polybar/scripts/space new file mode 100755 index 0000000..af5060a --- /dev/null +++ b/.config/polybar/scripts/space | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # Ankara & Eskisehir are about 200kms away long/lat wise; | ||
4 | # | ||
5 | # Ank: 39.925533, 32.866287 | ||
6 | # Esk: 39.766193, 30.526714. | ||
7 | # | ||
8 | # That's about 2.34 diff in longitude (much less in latitude), multiply by 100, | ||
9 | # get rid of the floating part (round down aggressively), 200 seems like a good | ||
10 | # margin, that's probably within Ankara borders | ||
11 | # | ||
12 | # The API recommends calling every 5 seconds (not more frequently, please!), 30 | ||
13 | # seems fine | ||
14 | # | ||
15 | # Coords below are from the METU hoodie :) | ||
16 | |||
17 | LEEWAY=200 | ||
18 | |||
19 | response=$(curl -s http://api.open-notify.org/iss-now.json) | ||
20 | |||
21 | lat=$(echo "${response}"| jq '.iss_position.latitude') | ||
22 | long=$(echo "${response}"| jq '.iss_position.longitude') | ||
23 | |||
24 | distlat=$(perl -e "print int(100 * abs(${lat} - 39.885833))") | ||
25 | distlong=$(perl -e "print int(100 * abs(${long} - 32.779444))") | ||
26 | |||
27 | if [ $distlat -lt $LEEWAY ] && [ $distlong -lt $LEEWAY ]; then | ||
28 | echo "" | ||
29 | else | ||
30 | echo | ||
31 | fi | ||