Merge branch 'master' of ssh://nielandt.be:2222/joachim/chezmoi into master
@ -26,7 +26,7 @@ URxvt*saveLines: 65500
|
|||||||
URxvt*loginShell: false
|
URxvt*loginShell: false
|
||||||
!URxvt*termName: screen-256color
|
!URxvt*termName: screen-256color
|
||||||
|
|
||||||
{{- if eq .chezmoi.hostname "carbonraptor" }}
|
{{- if eq .chezmoi.hostname "zaptorjezus" }}
|
||||||
URxvt.font: xft:Fura Code Nerd Font Mono:size=10:antialias=true
|
URxvt.font: xft:Fura Code Nerd Font Mono:size=10:antialias=true
|
||||||
URxvt.boldfont: xft:Fura Code Nerd Font Mono:bold:size=10
|
URxvt.boldfont: xft:Fura Code Nerd Font Mono:bold:size=10
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|||||||
@ -48,8 +48,8 @@ zinit light zsh-users/zsh-history-substring-search
|
|||||||
|
|
||||||
# Enhanced CD command
|
# Enhanced CD command
|
||||||
# wait lucid > suppress output on console, messes with p10 setup
|
# wait lucid > suppress output on console, messes with p10 setup
|
||||||
zinit wait lucid light-mode for \
|
#zinit wait lucid light-mode for \
|
||||||
b4b4r07/enhancd
|
# b4b4r07/enhancd
|
||||||
|
|
||||||
# Oh-My-Zsh plugins
|
# Oh-My-Zsh plugins
|
||||||
zinit snippet OMZ::plugins/git/git.plugin.zsh
|
zinit snippet OMZ::plugins/git/git.plugin.zsh
|
||||||
|
|||||||
@ -385,6 +385,12 @@ format-prefix-foreground = ${colors.bright_green}
|
|||||||
;format-underline = ${colors.underline-memory}
|
;format-underline = ${colors.underline-memory}
|
||||||
label = %percentage_used%%
|
label = %percentage_used%%
|
||||||
|
|
||||||
|
[module/updates-pacman]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/.dotfiles/polybar/polybar-scripts/polybar-scripts/updates-pacman/updates-pacman.sh
|
||||||
|
interval = 600
|
||||||
|
|
||||||
|
; this one was fased out, DEPRECATED
|
||||||
[module/updates-arch]
|
[module/updates-arch]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/.config/polybar/polybar-scripts/polybar-scripts/updates-arch/updates-arch.sh
|
exec = ~/.config/polybar/polybar-scripts/polybar-scripts/updates-arch/updates-arch.sh
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
# polybar-scripts
|
# polybar-scripts
|
||||||
|
|
||||||
[](https://travis-ci.org/x70b1/polybar-scripts)
|
[](https://github.com/polybar/polybar-scripts/actions)
|
||||||
[](https://github.com/x70b1/polybar-scripts/graphs/contributors)
|
[](https://github.com/polybar/polybar-scripts/graphs/contributors)
|
||||||
[](https://github.com/x70b1/polybar-scripts/blob/master/LICENSE)
|
[](https://github.com/polybar/polybar-scripts/blob/master/LICENSE)
|
||||||
|
|
||||||
This is a community project. We write and collect scripts for Polybar!
|
This is a community project. We write and collect scripts for Polybar!
|
||||||
|
|
||||||
@ -17,25 +17,39 @@ Your script isn't here yet? You have ideas to extend the scripts or descriptions
|
|||||||
|
|
||||||
Is this your first time here? You should definitely take a look at these scripts:
|
Is this your first time here? You should definitely take a look at these scripts:
|
||||||
|
|
||||||
* [battery-combined-udev](polybar-scripts/battery-combined-udev)
|
|
||||||
* [openweathermap-fullfeatured](polybar-scripts/openweathermap-fullfeatured)
|
* [openweathermap-fullfeatured](polybar-scripts/openweathermap-fullfeatured)
|
||||||
* [player-mpris-tail](polybar-scripts/player-mpris-tail)
|
* [player-mpris-tail](polybar-scripts/player-mpris-tail)
|
||||||
* [pulseaudio-tail](polybar-scripts/pulseaudio-tail)
|
* [battery-combined-udev](polybar-scripts/battery-combined-udev)
|
||||||
|
* [system-bluetooth-bluetoothctl](polybar-scripts/system-bluetooth-bluetoothctl)
|
||||||
|
* [notification-reddit](polybar-scripts/notification-reddit)
|
||||||
|
* [inbox-imap-shellnetrc](polybar-scripts/inbox-imap-shellnetrc)
|
||||||
|
* [isrunning-service](polybar-scripts/isrunning-service)
|
||||||
* [system-usb-udev](polybar-scripts/system-usb-udev)
|
* [system-usb-udev](polybar-scripts/system-usb-udev)
|
||||||
* [updates-arch-combined](polybar-scripts/updates-arch-combined)
|
* [updates-pacman-aurhelper](polybar-scripts/updates-pacman-aurhelper)
|
||||||
* [info-hackspeed](polybar-scripts/info-hackspeed)
|
* [info-hackspeed](polybar-scripts/info-hackspeed)
|
||||||
|
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
* Save the script of your choice somewhere at `~/.config/polybar/`.
|
||||||
|
* Don't forget to make the script executable: `chmod +x ~/.config/polybar/script.sh`.
|
||||||
|
* Copy the module settings into your configuration file.
|
||||||
|
* Replace the appropriate icon strings in the script (e.g. replace `#1` with `🎉`).
|
||||||
|
|
||||||
|
|
||||||
## all colors are beautiful
|
## all colors are beautiful
|
||||||
|
|
||||||
[](polybar-scripts/updates-arch-combined/)
|
[](polybar-scripts/updates-pacman-aurhelper/)
|
||||||
[](polybar-scripts/system-cpu-temppercore/)
|
[](polybar-scripts/system-cpu-temppercore/)
|
||||||
[](polybar-scripts/notification-chess/)
|
[](polybar-scripts/notification-chess/)
|
||||||
[](polybar-scripts/inbox-reddit/)
|
[](polybar-scripts/notification-reddit/)
|
||||||
[](polybar-scripts/openvpn-isrunning/)
|
[](polybar-scripts/vpn-openvpn-isrunning/)
|
||||||
[](polybar-scripts/inbox-imap-python/)
|
[](polybar-scripts/inbox-imap-pythongpg/)
|
||||||
[](polybar-scripts/openweathermap-fullfeatured/)
|
[](polybar-scripts/openweathermap-fullfeatured/)
|
||||||
[](polybar-scripts/ticker-btceur/)
|
[](polybar-scripts/ticker-crypto/)
|
||||||
|
[](polybar-scripts/info-docker/)
|
||||||
|
[](polybar-scripts/easteregg-pornhub/)
|
||||||
|
[](polybar-scripts/info-airqualityindex/)
|
||||||
[](polybar-scripts/player-mpris-simple/)
|
[](polybar-scripts/player-mpris-simple/)
|
||||||
[](polybar-scripts/battery-combined-tlp/)
|
[](polybar-scripts/battery-combined-tlp/)
|
||||||
[](polybar-scripts/info-projecthamster/)
|
[](polybar-scripts/info-projecthamster/)
|
||||||
@ -47,33 +61,65 @@ Is this your first time here? You should definitely take a look at these scripts
|
|||||||
[](polybar-scripts/openweathermap-detailed/)
|
[](polybar-scripts/openweathermap-detailed/)
|
||||||
[](polybar-scripts/info-hackspeed/)
|
[](polybar-scripts/info-hackspeed/)
|
||||||
[](polybar-scripts/info-xampp/)
|
[](polybar-scripts/info-xampp/)
|
||||||
|
[](polybar-scripts/info-taskspooler/)
|
||||||
|
[](polybar-scripts/network-publicip/)
|
||||||
|
[](polybar-scripts/system-thinklight/)
|
||||||
[](polybar-scripts/player-mpris-tail/)
|
[](polybar-scripts/player-mpris-tail/)
|
||||||
[](polybar-scripts/info-redshift-temp/)
|
[](polybar-scripts/info-redshift-temp/)
|
||||||
[](polybar-scripts/info-trash/)
|
[](polybar-scripts/info-trash/)
|
||||||
[](polybar-scripts/pulseaudio-rofi/)
|
[](polybar-scripts/vpn-wireguard-wg/)
|
||||||
[](polybar-scripts/info-softwarecounter/)
|
[](polybar-scripts/vpn-wireguard-wg/)
|
||||||
[](polybar-scripts/info-twitch-countdown/)
|
[](polybar-scripts/info-softwarecounter/)
|
||||||
[](polybar-scripts/info-twitch-countdown/)
|
[](polybar-scripts/vpn-anyconnect-status/)
|
||||||
|
[](polybar-scripts/player-cmus/)
|
||||||
[](polybar-scripts/info-todotxt/)
|
[](polybar-scripts/info-todotxt/)
|
||||||
|
[](polybar-scripts/vpn-networkmanager-status/)
|
||||||
[](polybar-scripts/info-wifionice/)
|
[](polybar-scripts/info-wifionice/)
|
||||||
|
[](polybar-scripts/network-localip/)
|
||||||
|
[](polybar-scripts/updates-dnf/)
|
||||||
|
[](polybar-scripts/system-eprivacy/)
|
||||||
|
[](polybar-scripts/network-ipinfo.io/)
|
||||||
|
[](polybar-scripts/system-gpu-optimus/)
|
||||||
|
[](polybar-scripts/info-tmux-sessions/)
|
||||||
|
[](polybar-scripts/info-hlwm-workspaces/)
|
||||||
|
[](polybar-scripts/info-hexdate/)
|
||||||
|
[](polybar-scripts/notification-spacex/)
|
||||||
|
|
||||||
|
|
||||||
## See also these other user repositories:
|
## See also these other user repositories:
|
||||||
|
|
||||||
* [vyachkonovalov/polybar-gmail](https://github.com/vyachkonovalov/polybar-gmail): A Polybar module to show unread messages from Gmail
|
* [vyachkonovalov/polybar-gmail](https://github.com/vyachkonovalov/polybar-gmail): A Polybar module to show unread messages from Gmail
|
||||||
|
* [vyachkonovalov/bar-protonmail](https://github.com/vyachkonovalov/bar-protonmail): A Waybar/Polybar module for ProtonMail
|
||||||
* [0nse/now_playing](https://github.com/0nse/now_playing): Output the currently scrobbling song
|
* [0nse/now_playing](https://github.com/0nse/now_playing): Output the currently scrobbling song
|
||||||
* [dakuten/taskwarrior-polybar](https://github.com/dakuten/taskwarrior-polybar): merely just a script showing the most urgent task and allowing it to be marked done
|
* [DRKblade/polybar-warrior](https://github.com/DRKblade/polybar-warrior): A script to browse through your tasks and mark them as done.
|
||||||
* [quelotic/polybarModules](https://github.com/quelotic/polybarModules): scripts for mail and caffeine
|
* [dakuten/taskwarrior-polybar](https://github.com/dakuten/taskwarrior-polybar): Merely just a script showing the most urgent task and allowing it to be marked done
|
||||||
|
* [quelotic/polybarModules](https://github.com/quelotic/polybarModules): Scripts for mail and caffeine
|
||||||
* [vyp/scripts](https://github.com/vyp/scripts): A script to show focused, occupied, free and urgent herbstluftwm tags in polybar
|
* [vyp/scripts](https://github.com/vyp/scripts): A script to show focused, occupied, free and urgent herbstluftwm tags in polybar
|
||||||
* [willHol/polybar-crypto](https://github.com/willHol/polybar-crypto): A polybar script that displays the price of crypto-currencies
|
* [willHol/polybar-crypto](https://github.com/willHol/polybar-crypto): A polybar script that displays the price of crypto-currencies
|
||||||
* [DanaruDev/UnseenMail](https://framagit.org/DanaruDev/UnseenMail): Polybar Python script for viewing unread email from multi accounts
|
* [DanaruDev/UnseenMail](https://framagit.org/DanaruDev/UnseenMail): Polybar Python script for viewing unread email from multi accounts
|
||||||
* [drdeimos/polybar_another_battery](https://github.com/drdeimos/polybar_another_battery): Simple battery charge level watcher with notifications (libnotify)
|
* [drdeimos/polybar_another_battery](https://github.com/drdeimos/polybar_another_battery): Simple battery charge level watcher with notifications (libnotify)
|
||||||
* [zemmsoares/polynews](https://github.com/zemmsoares/polynews): read news on your polybar
|
* [zemmsoares/polynews](https://github.com/zemmsoares/polynews): Read news on your polybar
|
||||||
|
* [nivit/polybar-module-earthquake](https://github.com/nivit/polybar-module-earthquake): Polybar module for showing the latest seismic event on Earth
|
||||||
|
* [nivit/polybar-module-news](https://github.com/nivit/polybar-module-news): This polybar module displays RSS/Atom feeds
|
||||||
## Setup
|
* [HackeSta/polybar-kdeconnect](https://github.com/HackeSta/polybar-kdeconnect): KDEConnect module for Polybar
|
||||||
|
* [zemmsoares/polybar-node-version](https://github.com/zemmsoares/polybar-node-version): Script to check Node.js version
|
||||||
* Save the script of your choice somewhere at `~/.config/polybar/`.
|
* [Jvanrhijn/polybar-spotify](https://github.com/Jvanrhijn/polybar-spotify): Shows the current song playing on Spotify
|
||||||
* Don't forget to make the script executable: `chmod +x ~/.config/polybar/script.sh`.
|
* [HackeSta/polybar-browsermediacontrol](https://github.com/HackeSta/polybar-browsermediacontrol): Browser Media Control module for Polybar
|
||||||
* Copy the module settings into your configuration file.
|
* [dietervanhoof/polybar-spotify-controls](https://github.com/dietervanhoof/polybar-spotify-controls): Set of modules provides controls for spotify
|
||||||
* Replace the appropriate icon strings in the script (e.g. replace `#1` with `🎉`).
|
* [mihirlad55/polybar-spotify-module](https://github.com/mihirlad55/polybar-spotify-module): Lightweight programs to integrate spotify into polybar
|
||||||
|
* [unode/polypomo](https://github.com/unode/polypomo): Minimalist pomodoro style timer
|
||||||
|
* [marioortizmanero/polybar-pulseaudio-control](https://github.com/marioortizmanero/polybar-pulseaudio-control): A feature-full polybar module to control pulseaudio
|
||||||
|
* [budlabs/polify](https://github.com/budlabs/polify): A utility that makes it easier to manage and work with polybars IPC-modules
|
||||||
|
* [VineshReddy/polybar-redshift](https://github.com/VineshReddy/polybar-redshift): Change, display temperature and open/close Redshift
|
||||||
|
* [gitlab.com/indeedwatson/polybar_twitch](https://gitlab.com/indeedwatson/polybar_twitch): Display live Twitch channels
|
||||||
|
* [jbirnick/polybar-timer](https://github.com/jbirnick/polybar-timer): Simple & customizable timer (can be used for pomodoro tracking).
|
||||||
|
* [zack-ashen/polystock](https://github.com/zack-ashen/polystock): Simple stock ticker displayer for displaying stock prices.
|
||||||
|
* [Hackesta/polybar-qbittorrent](https://github.com/HackeSta/polybar-qbittorrent): qBittorrent Module for Polybar
|
||||||
|
* [jbirnick/polybar-todoist](https://github.com/jbirnick/polybar-todoist): Displays amount of Todoist tasks of each priority.
|
||||||
|
* [PrayagS/polybar-spotify](https://github.com/PrayagS/polybar-spotify): Spotify status and controls module for Polybar with text scrolling
|
||||||
|
* [Hackesta/polybar-speedtest](https://github.com/HackeSta/polybar-speedtest): speedtest.net Module for Polybar
|
||||||
|
* [MaxdSre/mpris-player-control](https://github.com/MaxdSre/mpris-player-control): Control player via MPRIS D-Bus interface
|
||||||
|
* [maksmeshkov/toggl_polybar](https://github.com/maksmeshkov/toggl_polybar): Information about current running task for toggl.com time tracker users
|
||||||
|
* [shervinsahba/polybar-vpn-controller](https://github.com/shervinsahba/polybar-vpn-controller): VPN controller (toggle VPN, display location or IP, choose location via rofi menu, copy IP to clipboard)
|
||||||
|
* [madhat2r/polybar-i3-window](https://github.com/madhat2r/polybar-i3-window): A Polybar module to show i3 window title that can handle multi-monitors
|
||||||
|
* [sTiKyt/polybar-onlinestatus](https://github.com/sTiKyt/polybar-onlinestatus): Indicator of your internet connection
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
error_count=0
|
|
||||||
scripts="polybar-scripts/*/*.sh"
|
|
||||||
|
|
||||||
for file in $scripts; do
|
|
||||||
|
|
||||||
# Exceptions
|
|
||||||
if [ "$file" = "polybar-scripts/info-hackspeed/info-hackspeed.sh" ]; then
|
|
||||||
shellcheck --exclude=SC2016,SC2059 "$file"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
error_count=$((error_count+1))
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
shellcheck "$file"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
error_count=$((error_count+1))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $error_count -eq 0 ]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
language: c
|
|
||||||
|
|
||||||
install:
|
|
||||||
- scversion="stable"
|
|
||||||
- wget "https://storage.googleapis.com/shellcheck/shellcheck-$scversion.linux.x86_64.tar.xz"
|
|
||||||
- tar --xz -xvf "shellcheck-$scversion.linux.x86_64.tar.xz"
|
|
||||||
- shellcheck() { "shellcheck-$scversion/shellcheck" "$@"; }
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- shellcheck --version
|
|
||||||
|
|
||||||
script:
|
|
||||||
- source ${TRAVIS_BUILD_DIR}/build.sh
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
path_ac="/sys/class/power_supply/AC"
|
PATH_AC="/sys/class/power_supply/AC"
|
||||||
path_battery_0="/sys/class/power_supply/BAT0"
|
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
|
||||||
path_battery_1="/sys/class/power_supply/BAT1"
|
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
|
||||||
|
|
||||||
ac=0
|
ac=0
|
||||||
battery_level_0=0
|
battery_level_0=0
|
||||||
@ -10,24 +10,24 @@ battery_level_1=0
|
|||||||
battery_max_0=0
|
battery_max_0=0
|
||||||
battery_max_1=0
|
battery_max_1=0
|
||||||
|
|
||||||
if [ -f "$path_ac/online" ]; then
|
if [ -f "$PATH_AC/online" ]; then
|
||||||
ac=$(cat "$path_ac/online")
|
ac=$(cat "$PATH_AC/online")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_0/energy_now" ]; then
|
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
|
||||||
battery_level_0=$(cat "$path_battery_0/energy_now")
|
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_0/energy_full" ]; then
|
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
|
||||||
battery_max_0=$(cat "$path_battery_0/energy_full")
|
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_1/energy_now" ]; then
|
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
|
||||||
battery_level_1=$(cat "$path_battery_1/energy_now")
|
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_1/energy_full" ]; then
|
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
|
||||||
battery_max_1=$(cat "$path_battery_1/energy_full")
|
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
battery_level=$(("$battery_level_0 + $battery_level_1"))
|
battery_level=$(("$battery_level_0 + $battery_level_1"))
|
||||||
|
|||||||
@ -14,7 +14,7 @@ It uses TLP and requires root privileges. Note that the icon doesn't change.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
You may need to add `tlp-stat` command to the `/etc/sudoers` NOPASSWD of your user:
|
You have to add the `tlp-stat` command to the `/etc/sudoers` NOPASSWD of your user:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
user ALL=(ALL) NOPASSWD: /usr/bin/tlp-stat
|
user ALL=(ALL) NOPASSWD: /usr/bin/tlp-stat
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
battery=$(sudo tlp-stat -b | tail -2 | head -n 1 | tr -d -c "[:digit:],.")
|
battery=$(sudo tlp-stat -b | tac | grep -m 1 "Charge" | tr -d -c "[:digit:],.")
|
||||||
|
|
||||||
echo "# $battery %"
|
echo "# $battery %"
|
||||||
|
|||||||
@ -11,8 +11,6 @@ This script is able to display power supply changes in real time. For this udev
|
|||||||
|
|
||||||
Copy `95-battery.rules` to `/etc/udev/rules.d/95-battery.rules`. Make sure that the paths in the file have been modified properly.
|
Copy `95-battery.rules` to `/etc/udev/rules.d/95-battery.rules`. Make sure that the paths in the file have been modified properly.
|
||||||
|
|
||||||
Also change the file path in line `#65`.
|
|
||||||
|
|
||||||
|
|
||||||
## Module
|
## Module
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
battery_print() {
|
battery_print() {
|
||||||
path_ac="/sys/class/power_supply/AC"
|
PATH_AC="/sys/class/power_supply/AC"
|
||||||
path_battery_0="/sys/class/power_supply/BAT0"
|
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
|
||||||
path_battery_1="/sys/class/power_supply/BAT1"
|
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
|
||||||
|
|
||||||
ac=0
|
ac=0
|
||||||
battery_level_0=0
|
battery_level_0=0
|
||||||
@ -11,24 +11,24 @@ battery_print() {
|
|||||||
battery_max_0=0
|
battery_max_0=0
|
||||||
battery_max_1=0
|
battery_max_1=0
|
||||||
|
|
||||||
if [ -f "$path_ac/online" ]; then
|
if [ -f "$PATH_AC/online" ]; then
|
||||||
ac=$(cat "$path_ac/online")
|
ac=$(cat "$PATH_AC/online")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_0/energy_now" ]; then
|
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
|
||||||
battery_level_0=$(cat "$path_battery_0/energy_now")
|
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_0/energy_full" ]; then
|
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
|
||||||
battery_max_0=$(cat "$path_battery_0/energy_full")
|
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_1/energy_now" ]; then
|
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
|
||||||
battery_level_1=$(cat "$path_battery_1/energy_now")
|
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$path_battery_1/energy_full" ]; then
|
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
|
||||||
battery_max_1=$(cat "$path_battery_1/energy_full")
|
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
battery_level=$(("$battery_level_0 + $battery_level_1"))
|
battery_level=$(("$battery_level_0 + $battery_level_1"))
|
||||||
@ -62,7 +62,7 @@ battery_print() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
path_pid="/home/user/.config/polybar/battery-combined-udev.pid"
|
path_pid="/tmp/polybar-battery-combined-udev.pid"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--update)
|
--update)
|
||||||
|
|||||||
@ -12,7 +12,11 @@ This script is able to display power supply changes in real time.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
It requires access to run `pwrstat` as root, so you may need to adjust your system to allow this (for example `sudo`).
|
You have to add the `pwrstat` command to the `/etc/sudoers` NOPASSWD of your user:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
user ALL=(ALL) NOPASSWD: /usr/bin/pwrstat
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Module
|
## Module
|
||||||
|
|||||||
@ -0,0 +1,44 @@
|
|||||||
|
# Script: easteregg-pornhub
|
||||||
|
|
||||||
|
A script that shows a button and opens a random video at a large porn website.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Set your browser at the `click-left` option in your module.
|
||||||
|
|
||||||
|
You should also enable the overline and underline option in your polybar.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[bar/barname]
|
||||||
|
|
||||||
|
overline-size = 5
|
||||||
|
underline-size = 4
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/easteregg-pornhub]
|
||||||
|
type = custom/script
|
||||||
|
exec = echo " hub "
|
||||||
|
interval = 3600
|
||||||
|
click-left = "firefox --private-window https://pornhub.com/random" &
|
||||||
|
|
||||||
|
format = <label>
|
||||||
|
format-prefix = " Porn "
|
||||||
|
format-prefix-foreground = #ffffff
|
||||||
|
format-prefix-background = #000000
|
||||||
|
|
||||||
|
format-overline = #000000
|
||||||
|
format-underline = #000000
|
||||||
|
format-foreground = #000000
|
||||||
|
format-background = #ffa500
|
||||||
|
|
||||||
|
format-suffix = " "
|
||||||
|
format-suffix-background = #000000
|
||||||
|
format-suffix-foreground = #000000
|
||||||
|
```
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
@ -1,20 +0,0 @@
|
|||||||
# Script: inbox-imap-python
|
|
||||||
|
|
||||||
A script that shows if there are unread mails in your IMAPs inbox.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
For Gmail, you must allow [less secure apps](https://myaccount.google.com/security#connectedapps).
|
|
||||||
|
|
||||||
|
|
||||||
## Module
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[module/inbox-imap-python]
|
|
||||||
type = custom/script
|
|
||||||
exec = ~/polybar-scripts/inbox-imap-python.py
|
|
||||||
interval = 60
|
|
||||||
```
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
import imaplib
|
|
||||||
|
|
||||||
obj = imaplib.IMAP4_SSL('imap.mail.net', 993)
|
|
||||||
obj.login('userlogin', 'pass123')
|
|
||||||
obj.select()
|
|
||||||
|
|
||||||
print(len(obj.search(None, 'unseen')[1][0].split()))
|
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
# Script: inbox-imap-pythongpg
|
||||||
|
|
||||||
|
A script that shows if there are unread mails in your IMAPs inbox. Passwords are encrypted with gpg.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
You must have a gpg key to secure your password in configuration files. Encrypt your password using your gpg key like this.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
echo 'your password' > /tmp/imappass
|
||||||
|
gpg -er 'your gpg keyid' /tmp/imappass
|
||||||
|
mv /tmp/imappass.gpg ~/.imappass.gpg
|
||||||
|
shred /tmp/imappass && rm /tmp/imappass
|
||||||
|
```
|
||||||
|
|
||||||
|
For Gmail, you must allow [less secure apps](https://myaccount.google.com/security#connectedapps).
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/inbox-imap-pythongpg]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/inbox-imap-pythongpg.py
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import imaplib
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
completed_process = subprocess.run(['gpg', '-dq', os.path.join(os.getenv('HOME'), '.imappass.gpg')], check=True, stdout=subprocess.PIPE, encoding="utf-8");
|
||||||
|
password = completed_process.stdout[:-1]
|
||||||
|
obj = imaplib.IMAP4_SSL('imap.mail.net', 993)
|
||||||
|
# Only put your email address below.
|
||||||
|
obj.login('your email address', password)
|
||||||
|
obj.select()
|
||||||
|
|
||||||
|
print(len(obj.search(None, 'unseen')[1][0].split()))
|
||||||
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
@ -0,0 +1,22 @@
|
|||||||
|
# Script: inbox-imap-shellpass
|
||||||
|
|
||||||
|
A script that shows if there are unread mails in your IMAP inbox.
|
||||||
|
|
||||||
|
This script actually use IMAPs. `curl` can also handle unencrypted IMAP. You only need to change the protocol in the command.
|
||||||
|
|
||||||
|
The login data can be stored in your `pass` password manager.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `curl`
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/inbox-imap-shellpass]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/inbox-imap-shellpass.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SERVER=""
|
||||||
|
LOGIN=""
|
||||||
|
PASS=""
|
||||||
|
KEYGRIP=""
|
||||||
|
|
||||||
|
if [ "$(gpg-connect-agent 'keyinfo --list' /bye | grep "$KEYGRIP" | awk '{ print $7 }')" = 1 ]; then
|
||||||
|
password=$(pass show "$PASS" | head -n 1)
|
||||||
|
inbox=$(echo "user = \"$LOGIN:$password\"" | curl -sf -K- -X "STATUS INBOX (UNSEEN)" imaps://"$SERVER"/INBOX | tr -d -c "[:digit:]")
|
||||||
|
|
||||||
|
if [ "$inbox" ] && [ "$inbox" -gt 0 ]; then
|
||||||
|
echo "# $inbox"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# Script: inbox-reddit
|
|
||||||
|
|
||||||
A script that shows if there are unread mails in your Reddit inbox.
|
|
||||||
|
|
||||||
Type Reddit JSON URL from [reddit.com/prefs/feeds/](https://www.reddit.com/prefs/feeds/). Click `your inbox` > `unread messages` > `JSON` and copy the link.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
* `curl`
|
|
||||||
* `jq`
|
|
||||||
|
|
||||||
|
|
||||||
## Module
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[module/inbox-reddit]
|
|
||||||
type = custom/script
|
|
||||||
exec = ~/polybar-scripts/inbox-reddit.sh
|
|
||||||
interval = 60
|
|
||||||
```
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
url="your url here"
|
|
||||||
unread=$(curl -sf "$url" | jq '.["data"]["children"] | length')
|
|
||||||
|
|
||||||
case "$unread" in
|
|
||||||
''|*[!0-9]*)
|
|
||||||
unread=0
|
|
||||||
esac;
|
|
||||||
|
|
||||||
if [ "$unread" -gt 0 ]; then
|
|
||||||
echo "#1 $unread"
|
|
||||||
else
|
|
||||||
echo "#2"
|
|
||||||
fi
|
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
# Script: info-airqualityindex
|
||||||
|
|
||||||
|
A script that shows the local World Air Quality Index. It's an indicator for the air pollution.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `curl`
|
||||||
|
* `jq`
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
You need an API token. [Request one](https://aqicn.org/data-platform/token/).
|
||||||
|
|
||||||
|
Choose a city and make sure that the result is what you expect. `berlin` is a valid `CITY` here: http://aqicn.org/city/berlin/. Or use the [map](https://aqicn.org/map/) to find a monitoring station near you. `germany/berlin/friedrichshain-frankfurter-allee` works also as `CITY`.
|
||||||
|
|
||||||
|
If `CITY` is left empty, the location is retrieved via the Mozilla Location API.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-airqualityindex]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-airqualityindex.sh
|
||||||
|
interval = 600
|
||||||
|
```
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
TOKEN=""
|
||||||
|
CITY=""
|
||||||
|
|
||||||
|
API="https://api.waqi.info/feed"
|
||||||
|
|
||||||
|
if [ -n "$CITY" ]; then
|
||||||
|
aqi=$(curl -sf "$API/$CITY/?token=$TOKEN")
|
||||||
|
else
|
||||||
|
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
|
||||||
|
|
||||||
|
if [ -n "$location" ]; then
|
||||||
|
location_lat="$(echo "$location" | jq '.location.lat')"
|
||||||
|
location_lon="$(echo "$location" | jq '.location.lng')"
|
||||||
|
|
||||||
|
aqi=$(curl -sf "$API/geo:$location_lat;$location_lon/?token=$TOKEN")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$aqi" ]; then
|
||||||
|
if [ "$(echo "$aqi" | jq -r '.status')" = "ok" ]; then
|
||||||
|
aqi=$(echo "$aqi" | jq '.data.aqi')
|
||||||
|
|
||||||
|
if [ "$aqi" -lt 50 ]; then
|
||||||
|
echo "%{F#009966}#%{F-} $aqi"
|
||||||
|
elif [ "$aqi" -lt 100 ]; then
|
||||||
|
echo "%{F#ffde33}#%{F-} $aqi"
|
||||||
|
elif [ "$aqi" -lt 150 ]; then
|
||||||
|
echo "%{F#ff9933}#%{F-} $aqi"
|
||||||
|
elif [ "$aqi" -lt 200 ]; then
|
||||||
|
echo "%{F#cc0033}#%{F-} $aqi"
|
||||||
|
elif [ "$aqi" -lt 300 ]; then
|
||||||
|
echo "%{F#660099}#%{F-} $aqi"
|
||||||
|
else
|
||||||
|
echo "%{F#7e0023}#%{F-} $aqi"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$aqi" | jq -r '.data'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,26 @@
|
|||||||
|
# Script: info-docker
|
||||||
|
|
||||||
|
Shows the number of Docker containers in one of the states: `created`, `restarting`, `running`, `removing`, `paused`, `exited`, `dead`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
You have to add the `docker` command to the `/etc/sudoers` NOPASSWD of your user:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
user ALL=(ALL) NOPASSWD: /usr/bin/docker ps -qf status=running
|
||||||
|
user ALL=(ALL) NOPASSWD: /usr/bin/docker ps -qf status=exited
|
||||||
|
user ALL=(ALL) NOPASSWD: /usr/bin/docker ps -qf status=dead
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-docker]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-docker.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
STATUS="running exited dead"
|
||||||
|
|
||||||
|
for stat in $STATUS; do
|
||||||
|
output="$output $(sudo docker ps -qf status="$stat" | wc -l) |"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "|$output"
|
||||||
|
After Width: | Height: | Size: 626 B |
@ -0,0 +1,20 @@
|
|||||||
|
# Script: info-dualshock4
|
||||||
|
|
||||||
|
A shell script that shows the battery level of a DualShock 4 Controller.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The Icon is from [Font Awesome 5](https://fontawesome.com/icons/playstation?style=brands).
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/battery-dualshock4]
|
||||||
|
type= custom/script
|
||||||
|
exec = ~/polybar-scripts/info-dualshock4.sh
|
||||||
|
interval = 10
|
||||||
|
```
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for i in /sys/class/power_supply/sony_controller_battery_*/capacity; do
|
||||||
|
echo "# $(cat /sys/class/power_supply/sony_controller_battery_"$i"/capacity)%"
|
||||||
|
done
|
||||||
|
After Width: | Height: | Size: 4.0 KiB |
@ -0,0 +1,18 @@
|
|||||||
|
# Script: info-ethermine
|
||||||
|
|
||||||
|
This script reports the current hashrate (in MH/s) for your ethermine account.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `python-requests`
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-ethermine]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-ethermine.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
miner = ""
|
||||||
|
|
||||||
|
data = requests.get(f"https://api.ethermine.org/miner/{miner}/dashboard").json()['data']['statistics']
|
||||||
|
data = data[-1]
|
||||||
|
current_hash_rate = data["currentHashrate"]
|
||||||
|
currentMHs = round(current_hash_rate/1e6, 1)
|
||||||
|
|
||||||
|
print(f"{currentMHs}MH/s")
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
# Script: info-eyestrain
|
||||||
|
|
||||||
|
A script for avoiding digital eye strain.
|
||||||
|
|
||||||
|
It follows the 20-20-20 rule. The timer displays how long it is until the next break. You can add this to send a notification and play a sound when the time is up.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-eyestrain]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-eyestrain.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
time=$((20 - $(date '+%-M') % 20))
|
||||||
|
|
||||||
|
#if [ $time -eq 20 ]; then
|
||||||
|
# notify-send 'Break' &
|
||||||
|
# ogg123 beep.ogg &> /dev/null &
|
||||||
|
#fi
|
||||||
|
|
||||||
|
echo "$time"
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
# Script: info-gitlab-pipelines
|
||||||
|
|
||||||
|
Displays the number of succeeded, running and failed gitlab-pipelines triggered by a user.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* jq
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Insert the specific server-url, username and your GitLab token (Settings -> Access Token).
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-gitlab-pipelines]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-gitlab-pipelines.sh
|
||||||
|
interval = 30
|
||||||
|
...
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
GITLAB_USERNAME=""
|
||||||
|
GITLAB_SERVER="https://gitlab.com"
|
||||||
|
GITLAB_ACCESS_TOKEN=""
|
||||||
|
HOURS_AGO="6"
|
||||||
|
|
||||||
|
available_projects=$(curl -sH "Private-Token: $GITLAB_ACCESS_TOKEN" \
|
||||||
|
"$GITLAB_SERVER/api/v4/projects?membership=true" | jq '.[] | .id')
|
||||||
|
time=$(date -d "$HOURS_AGO hours ago" -Iseconds)
|
||||||
|
|
||||||
|
get_pipelines(){
|
||||||
|
curl -sH "Private-Token: $GITLAB_ACCESS_TOKEN" \
|
||||||
|
"$GITLAB_SERVER/api/v4/projects/$id/pipelines?username=$GITLAB_USERNAME&status=$1&updated_after=$time"| jq length
|
||||||
|
}
|
||||||
|
|
||||||
|
for id in $available_projects; do
|
||||||
|
success=$((success + $(get_pipelines "success")))
|
||||||
|
running=$((running + $(get_pipelines "running")))
|
||||||
|
failed=$((failed + $(get_pipelines "failed")))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "|%{F#7cfc00}$success%{F-}|%{F#ffff00}$running%{F-}|%{F#f00}$failed%{F-}|"
|
||||||
|
After Width: | Height: | Size: 602 B |
@ -18,7 +18,7 @@ A small script that shows your typing speed. Happy Hacking!
|
|||||||
* `METRIC`: either `cpm` (characters per minute) of `wpm` ([words per minute, 1 word = 5 characters](https://en.wikipedia.org/wiki/Words_per_minute)). Default: `cpm`
|
* `METRIC`: either `cpm` (characters per minute) of `wpm` ([words per minute, 1 word = 5 characters](https://en.wikipedia.org/wiki/Words_per_minute)). Default: `cpm`
|
||||||
* `FORMAT`: format string according to which the metric will be output. Default: `# %d $METRIC`
|
* `FORMAT`: format string according to which the metric will be output. Default: `# %d $METRIC`
|
||||||
* `INTERVAL`: amount of seconds to gather data. Default: 20
|
* `INTERVAL`: amount of seconds to gather data. Default: 20
|
||||||
* `LAYOUT`: keyboard layout, to be able to only count letters and numbers. Currently supported are `qwerty` and `azerty`. If you have a different layout, please contribute a condition for it! See the script's source code. Use the special value `dontcare` to count all keys, not just letters and numbers. Default: `qwerty`
|
* `LAYOUT`: keyboard layout, to be able to only count letters and numbers. Currently supported are `qwerty`, `azerty`, `qwertz` and `dvorak`. If you have a different layout, please contribute a condition for it! See the script's source code. Use the special value `dontcare` to count all keys, not just letters and numbers. Default: `qwerty`
|
||||||
|
|
||||||
If after 20 seconds the value stays at 0 even though you're typing, you may have to configure the name of your keyboard. Change the setting `KEYBOARD_ID` (see Configuration below) in the script. You can find your keyboard description with `xinput list --short`.
|
If after 20 seconds the value stays at 0 even though you're typing, you may have to configure the name of your keyboard. Change the setting `KEYBOARD_ID` (see Configuration below) in the script. You can find your keyboard description with `xinput list --short`.
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# shellcheck disable=SC2016,SC2059
|
||||||
|
|
||||||
KEYBOARD_ID="AT Translated Set 2 keyboard"
|
KEYBOARD_ID="AT Translated Set 2 keyboard"
|
||||||
|
|
||||||
# cpm: characters per minute
|
# cpm: characters per minute
|
||||||
# wpm: words per minute (1 word = 5 characters)
|
# wpm: words per minute (1 word = 5 characters)
|
||||||
METRIC=cpm
|
METRIC=cpm
|
||||||
FORMAT="%d $METRIC"
|
FORMAT="# %d $METRIC"
|
||||||
|
|
||||||
INTERVAL=20
|
INTERVAL=20
|
||||||
|
|
||||||
@ -18,7 +19,9 @@ LAYOUT=qwerty
|
|||||||
case "$LAYOUT" in
|
case "$LAYOUT" in
|
||||||
qwerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 53) || ($3 >= 52 && $3 <= 58)'; ;;
|
qwerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 53) || ($3 >= 52 && $3 <= 58)'; ;;
|
||||||
azerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 54) || ($3 >= 52 && $3 <= 57)'; ;;
|
azerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 54) || ($3 >= 52 && $3 <= 57)'; ;;
|
||||||
dontcare) CONDITION='1'; ;; # Just register all key presses, not only letters and numbers
|
qwertz) CONDITION='($3 >= 10 && $3 <= 20) || ($3 >= 24 && $3 <= 34) || ($3 == 36) || ($3 >= 38 && $3 <= 48) || ($3 >= 52 && $3 <= 58)'; ;;
|
||||||
|
dvorak) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 27 && $3 <= 33) || ($3 >= 38 && $3 <= 47) || ($3 >= 53 && $3 <= 61)'; ;;
|
||||||
|
dontcare) CONDITION='1'; ;; # Just register all key presses, not only letters and numbers
|
||||||
*) echo "Unsupported layout \"$LAYOUT\""; exit 1; ;;
|
*) echo "Unsupported layout \"$LAYOUT\""; exit 1; ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
# Script: info-hexdate
|
||||||
|
|
||||||
|
Print the current date in a hex format.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-hexdate]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-hexdate.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
day=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f3)
|
||||||
|
month=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f2)
|
||||||
|
year=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f1)
|
||||||
|
|
||||||
|
day=$(echo "obase=16; $day" | bc)
|
||||||
|
month=$(echo "obase=16; $month" | bc)
|
||||||
|
year=$(echo "obase=16; $year" | bc)
|
||||||
|
|
||||||
|
echo "$day-$month-$year"
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,27 @@
|
|||||||
|
# Script: info-hlwm-workspaces
|
||||||
|
|
||||||
|
Displays all herbstluftwm workspaces with support for all workspace states (`focused`, `visible`, `occupied`, `empty`, `urgent`).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `herbstluftwm` running as your WM
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
On its own the script is pretty plain as there are no colors. There are a bunch of <kbd>TODO</kbd> comments where you can `echo` [Formatting Tags](https://github.com/jaagr/polybar/wiki/Formatting#format-tags) for certain workspace state to make it more colorful and help you actually distinguish the different states.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-hlwm-workspaces]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-hlwm-workspaces.sh
|
||||||
|
tail = true
|
||||||
|
scroll-up = herbstclient use_index -1 --skip-visible &
|
||||||
|
scroll-down = herbstclient use_index +1 --skip-visible &
|
||||||
|
```
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
herbstclient --idle "tag_*" 2>/dev/null | {
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
# Read tags into $tags as array
|
||||||
|
IFS=$'\t' read -ra tags <<< "$(herbstclient tag_status)"
|
||||||
|
{
|
||||||
|
for i in "${tags[@]}" ; do
|
||||||
|
# Read the prefix from each tag and render them according to that prefix
|
||||||
|
case ${i:0:1} in
|
||||||
|
'#')
|
||||||
|
# the tag is viewed on the focused monitor
|
||||||
|
# TODO Add your formatting tags for focused workspaces
|
||||||
|
;;
|
||||||
|
':')
|
||||||
|
# : the tag is not empty
|
||||||
|
# TODO Add your formatting tags for occupied workspaces
|
||||||
|
;;
|
||||||
|
'!')
|
||||||
|
# ! the tag contains an urgent window
|
||||||
|
# TODO Add your formatting tags for workspaces with the urgent hint
|
||||||
|
;;
|
||||||
|
'-')
|
||||||
|
# - the tag is viewed on a monitor that is not focused
|
||||||
|
# TODO Add your formatting tags for visible but not focused workspaces
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# . the tag is empty
|
||||||
|
# There are also other possible prefixes but they won't appear here
|
||||||
|
echo "%{F-}%{B-}" # Add your formatting tags for empty workspaces
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "%{A1:herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "%{F-}%{B-}"
|
||||||
|
} | tr -d "\n"
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
# wait for next event from herbstclient --idle
|
||||||
|
read -r || break
|
||||||
|
done
|
||||||
|
} 2>/dev/null
|
||||||
|
After Width: | Height: | Size: 2.1 KiB |
@ -72,7 +72,7 @@ if GUI:
|
|||||||
wlist = [l.split() for l in subprocess.check_output(["wmctrl", "-lp"])\
|
wlist = [l.split() for l in subprocess.check_output(["wmctrl", "-lp"])\
|
||||||
.decode("utf-8").splitlines()]
|
.decode("utf-8").splitlines()]
|
||||||
validprocs = [
|
validprocs = [
|
||||||
get_process(w[2]) for w in wlist if check_wtype(w[0]) == True
|
get_process(w[2]) for w in wlist if check_wtype(w[0]) == True and w[2] != '0'
|
||||||
]
|
]
|
||||||
|
|
||||||
return validprocs
|
return validprocs
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
sessions="$(lsof -Pi | grep ":22")"
|
sessions="$(lsof -Pi | grep ":22")"
|
||||||
|
|
||||||
if [ ! -z "$sessions" ]; then
|
if [ -n "$sessions" ]; then
|
||||||
count=$(echo "$sessions" | wc -l)
|
count=$(echo "$sessions" | wc -l)
|
||||||
echo "# ($count): $(echo "$sessions" | cut -d ">" -f 2 | cut -d " " -f 1 | cut -d ":" -f 1 | tail -n 1)"
|
echo "# ($count): $(echo "$sessions" | cut -d ">" -f 2 | cut -d " " -f 1 | cut -d ":" -f 1 | tail -n 1)"
|
||||||
else
|
else
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
# Script: info-taskspooler
|
||||||
|
|
||||||
|
A small script that displays the number of queues/runtimes for one or more task spooler servers.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `task-spooler`
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
By default the script will output the count of the default task-spooler server.
|
||||||
|
|
||||||
|
Arguments can be passed to show custom task-spooler servers by using the `TS_SOCKET variable`. These custom servers will need to use a socket filename format like /tmp/ts-socket.SOCK_NAME or the script will be unable to find the server. Arguments are passed as `name,sock_name` with sock_name being optional, e.g. `default yt,youtube p,podcast`.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-taskspooler]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-task-spooler/info-taskspooler.sh
|
||||||
|
# exec = ~/polybar-scripts/info-taskspooler/info-taskspooler.sh default yt,youtube p,podcast
|
||||||
|
interval = 5
|
||||||
|
```
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# USAGE:
|
||||||
|
# No arguments: prints the job running/queued job count of the default tsp server
|
||||||
|
# Arguments: name,sock_name - one or more arguments, e.g. tsp yt,youtube p,podcasts
|
||||||
|
# sock_name is optional, will default to default tsp socket
|
||||||
|
# custom socket names will be generated as /tmp/ts-socket.SOCK_NAME, your TS_SOCKET will need to match
|
||||||
|
|
||||||
|
get_tsp_count() {
|
||||||
|
sock=/tmp/socket-ts.${1:-$(id -u)}
|
||||||
|
|
||||||
|
tsp_count=$(TS_SOCKET=$sock tsp|grep -E -c 'running|queued')
|
||||||
|
echo "${tsp_count:-0}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# without argument, just show count of default socket
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
get_tsp_count
|
||||||
|
else
|
||||||
|
for t in "$@"; do
|
||||||
|
IFS=, read -r name sock_name <<- EOF
|
||||||
|
${t}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "${name} $(get_tsp_count "${sock_name}")"
|
||||||
|
done|sed 'N;s/\n/ /'
|
||||||
|
fi
|
||||||
|
After Width: | Height: | Size: 3.3 KiB |
@ -0,0 +1,16 @@
|
|||||||
|
# Script: info-tmux-sessions
|
||||||
|
|
||||||
|
A simple script to show tmux sessions.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-tmux-sessions]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-tmux-sessions.sh
|
||||||
|
interval = 5
|
||||||
|
```
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
if sessionlist=$(tmux ls 2>/dev/null); then
|
||||||
|
printf "# "
|
||||||
|
|
||||||
|
echo "$sessionlist" | while read -r line; do
|
||||||
|
session=$(echo "$line" | cut -d ':' -f 1)
|
||||||
|
|
||||||
|
if echo "$line" | grep -q "(attached)"; then
|
||||||
|
status="(a)"
|
||||||
|
else
|
||||||
|
status=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s%s " "$session" "$status"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
else
|
||||||
|
printf "# none\n"
|
||||||
|
fi
|
||||||
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
@ -12,5 +12,5 @@ This script count the files in you trash directory.
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/polybar-scripts/info-trash.sh
|
exec = ~/polybar-scripts/info-trash.sh
|
||||||
interval = 60
|
interval = 60
|
||||||
click-left = ~/polybar-scripts/info-trash.sh --clean
|
click-left = ~/polybar-scripts/info-trash.sh --clean &
|
||||||
```
|
```
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
# Script: info-twitch-countdown
|
|
||||||
|
|
||||||
This script pulls the time a live streamer is streaming from their Streamlabs countdown on their twitch page.
|
|
||||||
|
|
||||||
Please note that because Streamlabs does not have a public API, a Chromium process is launched to gather the information. This will use about 250 MiB of memory for a few seconds every hour. You can also include multiple instances of this on your bar to view the stream times of multiple twitch streamers.
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
* `chromium`
|
|
||||||
* `jq`
|
|
||||||
* [cyrus-and/chrome-har-capturer](https://github.com/cyrus-and/chrome-har-capturer)
|
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Get a Twitch Client ID:
|
|
||||||
|
|
||||||
* Go to [twitch.tv/console/apps/create](https://glass.twitch.tv/console/apps/create) and sign in
|
|
||||||
* Login, then go to `Apps` > `Register`
|
|
||||||
* Use any name and category, and set OAuth Redirect URL to `http://localhost`
|
|
||||||
* Click Manage on the application, and copy the Client ID from the end of the URL or from the box
|
|
||||||
|
|
||||||
If you want to be hide the seconds on the counter, you may comment the "showSeconds" line in the script. Please note that you may experience 10-20 seconds pauses every hour when the countdown updates.
|
|
||||||
|
|
||||||
|
|
||||||
## Module
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[module/info-twitch-countdown]
|
|
||||||
type = custom/script
|
|
||||||
exec = ~/polybar-scripts/info-twitch-countdown.sh <streamer username>
|
|
||||||
tail = true
|
|
||||||
```
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
streamer="$1" # You may change this to the streamer's username to override the command line argument.
|
|
||||||
filePath=""
|
|
||||||
clientId=
|
|
||||||
showSeconds=":%S" # Uncomment to hide seconds in countdown
|
|
||||||
|
|
||||||
function checkLive() {
|
|
||||||
while [[ $(curl -s https://api.twitch.tv/helix/streams?user_login="$streamer" -H "Client-ID: $clientId" | jq '.data[] | select(.type=="live")') ]]; do
|
|
||||||
echo "#1 LIVE"
|
|
||||||
sleep 10
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateAuth() {
|
|
||||||
chromium --remote-debugging-port=9222 --headless >/dev/null 2>&1 & disown
|
|
||||||
sleep .1
|
|
||||||
chrome-har-capturer -f -c -g 7500 -o "$filePath/$streamer.har" https://twitch.tv/"$streamer" >/dev/null 2>&1
|
|
||||||
kill -1 "$(pgrep -f 'chromium --remote-debugging-port=9222 --headless')"
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkReauth() {
|
|
||||||
if [[ ! -f "$filePath/$streamer.har" || "$(($(date +%s)-$(date +%s -r "$filePath/$streamer.har")))" -gt 3300 ]]; then
|
|
||||||
updateAuth
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateData() {
|
|
||||||
auth=$(jq -r '.["log"]["entries"][]["request"] | select(.url=="https://xt.streamlabs.com/api/v5/twitch-extensions/countdown/settings") | select(.method=="GET") | .["headers"][] | select(.name=="authorization") | .value' "$filePath/$streamer.har")
|
|
||||||
countdownData=$(curl -s https://xt.streamlabs.com/api/v5/twitch-extensions/countdown/settings -H "Authorization: $auth")
|
|
||||||
days=$(echo "$countdownData" | jq -r '.["enabled"] | keys[] as $k | "\($k), \(.[$k])" | select(endswith("true"))' | cut -d ',' -f1)
|
|
||||||
[[ -n "$1" ]] && days=$(echo "$days" | sed "/$1/d")
|
|
||||||
|
|
||||||
closestDay="8days"
|
|
||||||
for i in $days; do
|
|
||||||
dayUnixTime=$(date +%s --date="$i")
|
|
||||||
if [[ "$dayUnixTime" -lt "$(date +%s --date=$closestDay)" ]]; then
|
|
||||||
closestDay="$i"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
hour=$(echo "$countdownData" | jq -r ".[\"$closestDay\"][][\"HH\"]")
|
|
||||||
minute=$(echo "$countdownData" | jq -r ".[\"$closestDay\"][][\"mm\"]")
|
|
||||||
timeZone=$(echo "$countdownData" | jq '.["timezone"]')
|
|
||||||
streamTime=$(date +%s --date="TZ=$timeZone $closestDay $hour:$minute")
|
|
||||||
[[ "$(date +%s)" -gt "$streamTime" ]] && updateData "$closestDay"
|
|
||||||
}
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
while [[ "$streamTime" -ge "$(date +%s)" ]]; do
|
|
||||||
daysUntil="$(((streamTime - $(date +%s))/86400)):"
|
|
||||||
[[ "$daysUntil" == "0:" ]] && daysUntil=
|
|
||||||
countdown="$(date -u --date @$((streamTime - "$(date +%s)")) +$daysUntil%H:%M"$showSeconds")"
|
|
||||||
echo "#2 $countdown"
|
|
||||||
[ $(($(date +%s) % 10)) -eq 0 ] && checkLive
|
|
||||||
checkReauth
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
checkLive
|
|
||||||
updateAuth
|
|
||||||
updateData
|
|
||||||
main
|
|
||||||
}
|
|
||||||
|
|
||||||
checkLive
|
|
||||||
updateAuth
|
|
||||||
updateData
|
|
||||||
main
|
|
||||||
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,4 @@
|
|||||||
|
ACTION=="add", SUBSYSTEM=="tty"
|
||||||
|
RUN+="/home/user/.config/polybar/info-usbtoserial.sh --update"
|
||||||
|
ACTION=="remove", SUBSYSTEM=="tty"
|
||||||
|
RUN+="/home/user/.config/polybar/info-usbtoserial.sh --update"
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
# Script: info-usbtoserial
|
||||||
|
|
||||||
|
A small script which shows the USB-to-Serial converters that are connected.
|
||||||
|
|
||||||
|
This script is able to display device changes in real time. For this udev is being used.
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Copy `95-usbtoserial.rules` to `/etc/udev/rules.d/95-usbtoserial.rules`. Make sure that the paths in the file have been modified properly.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-usbtoserial]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-usbtoserial.sh
|
||||||
|
tail = true
|
||||||
|
```
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
usbtoserial_print() {
|
||||||
|
devices=$(find /dev/ -name "ttyUSB*")
|
||||||
|
|
||||||
|
counter=0
|
||||||
|
for device in $devices; do
|
||||||
|
device_name=$(udevadm info --query=property --export --name "$device" | grep ID_MODEL_FROM_DATABASE | cut -d "'" -f 2 | cut -d ' ' -f 1)
|
||||||
|
|
||||||
|
if [ $counter -gt 0 ]; then
|
||||||
|
printf ", %s" "$device_name"
|
||||||
|
else
|
||||||
|
printf "#1 %s" "$device_name"
|
||||||
|
fi
|
||||||
|
|
||||||
|
counter=$((counter + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
path_pid="/tmp/polybar-usbtoserial.pid"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--update)
|
||||||
|
pid=$(cat $path_pid)
|
||||||
|
|
||||||
|
if [ "$pid" != "" ]; then
|
||||||
|
kill -10 "$pid"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $$ > $path_pid
|
||||||
|
|
||||||
|
trap exit INT
|
||||||
|
trap "echo" USR1
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
usbtoserial_print
|
||||||
|
|
||||||
|
sleep 30 &
|
||||||
|
wait
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -1,30 +1,34 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
wifionice=$(curl -sf https://iceportal.de/api1/rs/status)
|
if [ "$(iwgetid -r)" = "WIFIonICE" ]; then
|
||||||
|
wifionice=$(curl -sf https://iceportal.de/api1/rs/status)
|
||||||
|
|
||||||
if [ "$(echo "$wifionice" | jq .connection)" = "true" ]; then
|
if [ "$(echo "$wifionice" | jq .connection)" = "true" ]; then
|
||||||
wifionice_speed=$(echo "$wifionice" | jq .speed)
|
wifionice_speed=$(echo "$wifionice" | jq .speed)
|
||||||
if [ "$wifionice_speed" -ne 0 ]; then
|
if [ "$wifionice_speed" -ne 0 ]; then
|
||||||
wifionice_speed="$wifionice_speed km/h"
|
wifionice_speed=" - $wifionice_speed km/h"
|
||||||
else
|
else
|
||||||
wifionice_speed=""
|
wifionice_speed=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
station=$(curl -sf https://iceportal.de/api1/rs/tripInfo/trip | jq '[.[].stops[]? | select(.info.passed == false)][0]')
|
||||||
|
|
||||||
|
station_name=$(echo "$station" | jq -r '.station.name')
|
||||||
|
|
||||||
|
station_track=$(echo "$station" | jq -r '.track.actual')
|
||||||
|
|
||||||
|
station_arrival=$(echo "$station" | jq -r '.timetable.scheduledArrivalTime')
|
||||||
|
station_arrival=$(date --date="@$((station_arrival / 1000))" +%H:%M)
|
||||||
|
|
||||||
|
station_delay=$(echo "$station" | jq -r '.timetable.arrivalDelay')
|
||||||
|
if [ -n "$station_delay" ]; then
|
||||||
|
station_delay=" %{F#d60606}($station_delay)%{F-}"
|
||||||
|
else
|
||||||
|
station_delay=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "# $station_arrival$station_delay - $station_name, Gl. $station_track$wifionice_speed"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
station=$(curl -sf https://iceportal.de/api1/rs/tripInfo/trip | jq '[.[].stops[]? | select(.info.passed == false)][0]')
|
echo ""
|
||||||
|
|
||||||
station_name=$(echo "$station" | jq -r '.station.name')
|
|
||||||
|
|
||||||
station_track=$(echo "$station" | jq -r '.track.actual')
|
|
||||||
|
|
||||||
station_arrival=$(echo "$station" | jq -r '.timetable.scheduledArrivalTime')
|
|
||||||
station_arrival=$(date --date="@$((station_arrival / 1000))" +%H:%M)
|
|
||||||
|
|
||||||
station_delay=$(echo "$station" | jq -r '.timetable.arrivalDelay')
|
|
||||||
if [ ! -z "$station_delay" ]; then
|
|
||||||
station_delay=" %{F#d60606}($station_delay)%{F-}"
|
|
||||||
else
|
|
||||||
station_delay=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "# $station_arrival$station_delay - $station_name, Gl. $station_track - $wifionice_speed"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -17,5 +17,5 @@ The BSPWM window manger, and maybe some more, has some problems with java scalin
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/polybar-scripts/info-wmname.sh
|
exec = ~/polybar-scripts/info-wmname.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/polybar-scripts/info-wmname.sh --toggle
|
click-left = ~/polybar-scripts/info-wmname.sh --toggle &
|
||||||
```
|
```
|
||||||
|
|||||||
@ -9,7 +9,6 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
wmname=$(wmname)
|
echo "# $(wmname)"
|
||||||
echo "# $wmname"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@ -7,7 +7,7 @@ The Script prints the status of [XAMPP](https://www.apachefriends.org/de/index.h
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
You may need to add `xampp` command to the `/etc/sudoers` NOPASSWD of your user:
|
You have to add the `xampp` command to the `/etc/sudoers` NOPASSWD of your user:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
user ALL=(ALL) NOPASSWD: /opt/lampp/xampp
|
user ALL=(ALL) NOPASSWD: /opt/lampp/xampp
|
||||||
|
|||||||
@ -6,7 +6,7 @@ else
|
|||||||
status_apache="#12"
|
status_apache="#12"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if sudo /opt/lampp/xampp status |grep -q "MySQL is running."; then
|
if sudo /opt/lampp/xampp status | grep -q "MySQL is running."; then
|
||||||
status_mysql="#21"
|
status_mysql="#21"
|
||||||
else
|
else
|
||||||
status_mysql="#22"
|
status_mysql="#22"
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
# Script: isactive-bluetooth
|
|
||||||
|
|
||||||
A script that shows if bluetooth is on or off.
|
|
||||||
|
|
||||||
|
|
||||||
## Module
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[module/isactive-bluetooth]
|
|
||||||
type = custom/script
|
|
||||||
exec = ~/polybar-scripts/isactive-bluetooth.sh
|
|
||||||
interval = 10
|
|
||||||
```
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ "$(systemctl is-active bluetooth.service)" = "active" ]; then
|
|
||||||
echo "#1"
|
|
||||||
else
|
|
||||||
echo "#2"
|
|
||||||
fi
|
|
||||||
@ -12,5 +12,5 @@ Left click launches or closes claudius.
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/polybar-scripts/isrunning-claudius.sh
|
exec = ~/polybar-scripts/isrunning-claudius.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/polybar-scripts/isrunning-claudius --toggle
|
click-left = ~/polybar-scripts/isrunning-claudius --toggle &
|
||||||
```
|
```
|
||||||
|
|||||||
@ -10,5 +10,5 @@ A simple script that allows you to toggle compton and shows if it is running.
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/polybar-scripts/isrunning-compton.sh
|
exec = ~/polybar-scripts/isrunning-compton.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/polybar-scripts/isrunning-compton.sh --toggle
|
click-left = ~/polybar-scripts/isrunning-compton.sh --toggle &
|
||||||
```
|
```
|
||||||
|
|||||||
@ -10,5 +10,5 @@ A script that shows if the dropbox client is running. You can also start and sto
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/polybar-scripts/dropbox-isrunning.sh
|
exec = ~/polybar-scripts/dropbox-isrunning.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/polybar-scripts/dropbox-isrunning.sh --toggle
|
click-left = ~/polybar-scripts/dropbox-isrunning.sh --toggle &
|
||||||
```
|
```
|
||||||
|
|||||||
@ -10,5 +10,5 @@ A script that shows if offlineimap is running. The scripts require you to have s
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/polybar-scripts/offlineimap-isrunning.sh
|
exec = ~/polybar-scripts/offlineimap-isrunning.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/polybar-scripts/offlineimap-isrunning.sh --toggle
|
click-left = ~/polybar-scripts/offlineimap-isrunning.sh --toggle &
|
||||||
```
|
```
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
# Script: isrunning-service
|
||||||
|
|
||||||
|
A script that shows if a systemd service is running. It uses `journalctl` to get realtime output.
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Make sure that your user is member of the group `systemd-journal` to read all events.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/isrunning-service]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/isrunning-service.sh
|
||||||
|
tail = true
|
||||||
|
```
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
UNIT="docker.service"
|
||||||
|
|
||||||
|
journalctl --follow -o cat --unit $UNIT | while read -r; do
|
||||||
|
if [ "$(systemctl is-active "$UNIT")" = "active" ]; then
|
||||||
|
echo "#1"
|
||||||
|
else
|
||||||
|
echo "#2"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
# Script: network-ipinfo.io
|
||||||
|
|
||||||
|
Shows your public IP address and country of origin retrieved from `ipinfo.io`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `curl`
|
||||||
|
* `jq`
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The minimum interval of 60 seconds is important since free usage is limited to 50,000 API requests per month.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/network-ipinfo.io]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/.config/polybar/network-ipinfo.io.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ipinfo=$(curl -sf "https://ipinfo.io/json")
|
||||||
|
|
||||||
|
if [ -n "$ipinfo" ]; then
|
||||||
|
ipinfo_ip=$(echo "$ipinfo" | jq -r '.ip')
|
||||||
|
ipinfo_country=$(echo "$ipinfo" | jq -r '.country')
|
||||||
|
|
||||||
|
echo "# $ipinfo_ip [ $ipinfo_country ]"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
# Script: network-localip
|
||||||
|
|
||||||
|
This script shows the local IP of the current connection.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/network-localip]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/network-localip.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
local_interface=$(route | awk '/^default/{print $NF}')
|
||||||
|
local_ip=$(ip addr show "$local_interface" | grep -w "inet" | awk '{ print $2; }' | sed 's/\/.*$//')
|
||||||
|
|
||||||
|
echo "# $local_ip"
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
case "$2" in
|
||||||
|
up)
|
||||||
|
sh /home/user/.config/polybar/network.sh --update
|
||||||
|
;;
|
||||||
|
down)
|
||||||
|
sh /home/user/.config/polybar/network.sh --update
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
# Script: network-networkmanager
|
||||||
|
|
||||||
|
A shell script that shows the status of NetworkManager.
|
||||||
|
|
||||||
|
It shows connection changes in real time.
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Copy `90-polybar` to `/etc/NetworkManager/dispatcher.d/90-polybar`. Make sure that the paths in the file have been modified properly. The script needs to be executable.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/network-networkmanager]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/network-networkmanager.sh
|
||||||
|
tail = true
|
||||||
|
```
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
network_print() {
|
||||||
|
connection_list=$(nmcli -t -f name,type,device,state connection show --order name --active 2>/dev/null | grep -v ':bridge:')
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
if [ -n "$connection_list" ] && [ "$(echo "$connection_list" | wc -l)" -gt 0 ]; then
|
||||||
|
echo "$connection_list" | while read -r line; do
|
||||||
|
description=$(echo "$line" | sed -e 's/\\:/-/g' | cut -d ':' -f 1)
|
||||||
|
type=$(echo "$line" | sed -e 's/\\:/-/g' | cut -d ':' -f 2)
|
||||||
|
device=$(echo "$line" | sed -e 's/\\:/-/g' | cut -d ':' -f 3)
|
||||||
|
state=$(echo "$line" | sed -e 's/\\:/-/g' | cut -d ':' -f 4)
|
||||||
|
|
||||||
|
if [ "$state" = "activated" ]; then
|
||||||
|
if [ "$type" = "802-11-wireless" ]; then
|
||||||
|
icon="#1"
|
||||||
|
|
||||||
|
signal=$(nmcli -t -f in-use,signal device wifi list ifname "$device" | grep "\*" | cut -d ':' -f 2)
|
||||||
|
if [ "$signal" -lt 40 ]; then
|
||||||
|
description="$description - %{F#f9cc18}$signal%%{F-}"
|
||||||
|
fi
|
||||||
|
elif [ "$type" = "802-3-ethernet" ]; then
|
||||||
|
icon="#2"
|
||||||
|
|
||||||
|
speed="$(cat /sys/class/net/"$device"/speed)"
|
||||||
|
if [ "$speed" -ne -1 ]; then
|
||||||
|
if [ "$speed" -eq 1000 ]; then
|
||||||
|
speed="1G"
|
||||||
|
else
|
||||||
|
speed=$speed"M"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
speed="?"
|
||||||
|
fi
|
||||||
|
|
||||||
|
description="$description ($speed)"
|
||||||
|
elif [ "$type" = "bluetooth" ]; then
|
||||||
|
icon="#3"
|
||||||
|
|
||||||
|
description="$description"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $counter -gt 0 ]; then
|
||||||
|
printf " %s %s" "$icon" "$description"
|
||||||
|
else
|
||||||
|
printf "%s %s" "$icon" "$description"
|
||||||
|
fi
|
||||||
|
|
||||||
|
counter=$((counter + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
else
|
||||||
|
echo "#3"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
network_update() {
|
||||||
|
pid=$(cat "$path_pid")
|
||||||
|
|
||||||
|
if [ "$pid" != "" ]; then
|
||||||
|
kill -10 "$pid"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
path_pid="/tmp/polybar-network-networkmanager.pid"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--update)
|
||||||
|
network_update
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $$ > $path_pid
|
||||||
|
|
||||||
|
trap exit INT
|
||||||
|
trap "echo" USR1
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
network_print
|
||||||
|
|
||||||
|
sleep 60 &
|
||||||
|
wait
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
# Script: network-publicip
|
||||||
|
|
||||||
|
This script shows the public IP of the current connection.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `curl`
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/network-publicip]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/network-publicip.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "# $(curl -4 -sf ifconfig.co)"
|
||||||
|
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,25 @@
|
|||||||
|
# Script: network-traffic
|
||||||
|
|
||||||
|
A script that displays the current network traffic.
|
||||||
|
|
||||||
|
It allows you to count traffic from more then one interface.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `bc`
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Change the values in `INTERVAL` and `INTERFACES`. You can also choose between bit and byte output.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/network-traffic]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/network-traffic.sh
|
||||||
|
tail = true
|
||||||
|
```
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_bytes() {
|
||||||
|
if [ "$1" -eq 0 ] || [ "$1" -lt 1000 ]; then
|
||||||
|
bytes="0 kB/s"
|
||||||
|
elif [ "$1" -lt 1000000 ]; then
|
||||||
|
bytes="$(echo "scale=0;$1/1000" | bc -l ) kB/s"
|
||||||
|
else
|
||||||
|
bytes="$(echo "scale=1;$1/1000000" | bc -l ) MB/s"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$bytes"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_bit() {
|
||||||
|
if [ "$1" -eq 0 ] || [ "$1" -lt 10 ]; then
|
||||||
|
bit="0 B"
|
||||||
|
elif [ "$1" -lt 100 ]; then
|
||||||
|
bit="$(echo "scale=0;$1*8" | bc -l ) B"
|
||||||
|
elif [ "$1" -lt 100000 ]; then
|
||||||
|
bit="$(echo "scale=0;$1*8/1000" | bc -l ) K"
|
||||||
|
else
|
||||||
|
bit="$(echo "scale=1;$1*8/1000000" | bc -l ) M"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$bit"
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERVAL=10
|
||||||
|
INTERFACES="enp0s25 wlp3s0"
|
||||||
|
|
||||||
|
declare -A bytes
|
||||||
|
|
||||||
|
for interface in $INTERFACES; do
|
||||||
|
bytes[past_rx_$interface]="$(cat /sys/class/net/"$interface"/statistics/rx_bytes)"
|
||||||
|
bytes[past_tx_$interface]="$(cat /sys/class/net/"$interface"/statistics/tx_bytes)"
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
down=0
|
||||||
|
up=0
|
||||||
|
|
||||||
|
for interface in $INTERFACES; do
|
||||||
|
bytes[now_rx_$interface]="$(cat /sys/class/net/"$interface"/statistics/rx_bytes)"
|
||||||
|
bytes[now_tx_$interface]="$(cat /sys/class/net/"$interface"/statistics/tx_bytes)"
|
||||||
|
|
||||||
|
bytes_down=$((((${bytes[now_rx_$interface]} - ${bytes[past_rx_$interface]})) / INTERVAL))
|
||||||
|
bytes_up=$((((${bytes[now_tx_$interface]} - ${bytes[past_tx_$interface]})) / INTERVAL))
|
||||||
|
|
||||||
|
down=$(((( "$down" + "$bytes_down" ))))
|
||||||
|
up=$(((( "$up" + "$bytes_up" ))))
|
||||||
|
|
||||||
|
bytes[past_rx_$interface]=${bytes[now_rx_$interface]}
|
||||||
|
bytes[past_tx_$interface]=${bytes[now_tx_$interface]}
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Download: $(print_bytes $down) / Upload: $(print_bytes $up)"
|
||||||
|
# echo "Download: $(print_bit $down) / Upload: $(print_bit $up)"
|
||||||
|
|
||||||
|
sleep $INTERVAL
|
||||||
|
done
|
||||||
@ -1,12 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
from feedparser import parse
|
||||||
|
|
||||||
import feedparser
|
URL = 'https://www.archlinux.org/feeds/news/'
|
||||||
from subprocess import call
|
ENTRIES = 1
|
||||||
import re
|
|
||||||
import textwrap
|
|
||||||
|
|
||||||
d = feedparser.parse("https://www.archlinux.org/feeds/news/")
|
[print(x.title) for x in parse(URL).entries[:ENTRIES]]
|
||||||
|
|
||||||
for f in range(0, 1):
|
|
||||||
print(d.entries[f].title)
|
|
||||||
xy = d.entries[f].title
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
username=""
|
USERNAME=""
|
||||||
games=$(curl -sf "https://api.chess.com/pub/player/$username/games/to-move" | jq ".[] | length")
|
games=$(curl -sf "https://api.chess.com/pub/player/$USERNAME/games/to-move" | jq ".[] | length")
|
||||||
|
|
||||||
if [ "$games" -gt 0 ]; then
|
if [ "$games" -gt 0 ]; then
|
||||||
echo "#1 $games"
|
echo "#1 $games"
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
USER=""
|
||||||
TOKEN="1234567890"
|
TOKEN="1234567890"
|
||||||
|
|
||||||
notifications=$(curl -fs https://api.github.com/notifications?access_token=$TOKEN | jq ".[].unread" | grep -c true)
|
notifications=$(echo "user = \"$USER:$TOKEN\"" | curl -sf -K- https://api.github.com/notifications | jq ".[].unread" | grep -c true)
|
||||||
|
|
||||||
if [ "$notifications" -gt 0 ]; then
|
if [ "$notifications" -gt 0 ]; then
|
||||||
echo "# $notifications"
|
echo "# $notifications"
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
# Script: notification-reddit
|
||||||
|
|
||||||
|
A script that shows if there are unread mails in your reddit inbox.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `curl`
|
||||||
|
* `jq`
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Open [reddit.com/prefs/feeds/](https://www.reddit.com/prefs/feeds/). Copy the `JSON` link from `your inbox` > `unread messages`.
|
||||||
|
|
||||||
|
Add your username at the end of `USERAGENT` to create a unique string.
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/notification-reddit]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/notification-reddit.sh
|
||||||
|
interval = 60
|
||||||
|
```
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
URL=""
|
||||||
|
USERAGENT="polybar-scripts/notification-reddit:v1.0 u/reddituser"
|
||||||
|
|
||||||
|
notifications=$(curl -sf --user-agent "$USERAGENT" "$URL" | jq '.["data"]["children"] | length')
|
||||||
|
|
||||||
|
if [ -n "$notifications" ] && [ "$notifications" -gt 0 ]; then
|
||||||
|
echo "#1 $notifications"
|
||||||
|
else
|
||||||
|
echo "#2"
|
||||||
|
fi
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,21 @@
|
|||||||
|
# Script: notification-spacex
|
||||||
|
|
||||||
|
A script that shows when the next launch is planned.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* `curl`
|
||||||
|
* `jq`
|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/notification-spacex]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/notification-spacex.sh
|
||||||
|
interval = 600
|
||||||
|
```
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
spacex_launch=$(curl -sf https://api.spacexdata.com/v3/launches/next)
|
||||||
|
|
||||||
|
if [ -n "$spacex_launch" ]; then
|
||||||
|
spacex_precision=$(echo "$spacex_launch" | jq -r '.tentative_max_precision' )
|
||||||
|
spacex_timestamp=$(echo "$spacex_launch" | jq -r '.launch_date_unix' )
|
||||||
|
spacex_duration=$((spacex_timestamp - $(date +%s)))
|
||||||
|
|
||||||
|
if [ "$spacex_precision" = "hour" ] && [ "$spacex_duration" -lt 43200 ]; then
|
||||||
|
echo "# $(date +"%H:%M" -u --date @$spacex_duration)"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |