Removed the polybar-scripts repo from this repository.

- from now on: pull polybar-scripts into ~/.config
- any desired scripts are copied into $CHEZMOI/polybar/polybar-scripts
- then, check for differences between $CHEZMOI/polybar/polybar-scripts
- TODO perform these diff checks using a script
This commit is contained in:
Joachim Nielandt 2021-11-08 10:50:56 +01:00
parent 5a2d143831
commit 11c51544b9
261 changed files with 41 additions and 4552 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Polybar scripts
Clone polybar-scripts into `.config`. Some scripts can be used to check differences with the local copies. Polybar-scripts is not included in the chezmoi repo anymore, only modified copies of selected scripts.
`git clone https://github.com/polybar/polybar-scripts.git ~/.config/`

View File

@ -1,7 +1,7 @@
# Zu's dotfiles # Zu's dotfiles
It seems something everyone's doing: keep everything (dot / config files) together in one single directory and then symlink wherever appropriate. Feel free to use these files at your own peril. These dotfiles are managed by chezmoi. Feel free to use these file and remove all functionality from your pc.
Everything below assumes this repo is cloned in ~/.dotfiles. Everything below assumes this repo is cloned in ~/.dotfiles.
## Dependencies ## Dependencies

View File

@ -141,7 +141,7 @@ padding-right = 2
[module/player-mpris-tail] [module/player-mpris-tail]
type = custom/script type = custom/script
exec = ~/.config/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/player-mpris-tail.py -f '{icon} {artist} - {:t30:{title}:}' --icon-playing  --icon-paused  --icon-stopped  --icon-none ﱙ exec = ~/.config/polybar/polybar-scripts/player-mpris-tail/player-mpris-tail.py -f '{icon} {artist} - {:t30:{title}:}' --icon-playing  --icon-paused  --icon-stopped  --icon-none ﱙ
tail = true tail = true
label = %output% label = %output%
label-foreground = ${colors.light0_hard} label-foreground = ${colors.light0_hard}
@ -150,7 +150,7 @@ label-foreground = ${colors.light0_hard}
type = custom/script type = custom/script
format-prefix = " " format-prefix = " "
format-prefix-foreground = ${colors.bright_green} format-prefix-foreground = ${colors.bright_green}
exec = ~/.config/polybar/polybar-scripts/polybar-scripts/info-hackspeed/info-hackspeed.sh exec = ~/.config/polybar/polybar-scripts/info-hackspeed/info-hackspeed.sh
tail = true tail = true
[module/obelisk-status] [module/obelisk-status]
@ -388,12 +388,12 @@ label = %percentage_used%%
[module/updates-pacman] [module/updates-pacman]
type = custom/script type = custom/script
exec = ~/.dotfiles/polybar/polybar-scripts/polybar-scripts/updates-pacman/updates-pacman.sh exec = ~/.dotfiles/polybar/polybar-scripts/updates-pacman/updates-pacman.sh
interval = 600 interval = 600
[module/updates-aurhelper] [module/updates-aurhelper]
type = custom/script type = custom/script
exec = ~/.dotfiles/polybar/polybar-scripts/polybar-scripts/updates-aurhelper/updates-aurhelper.sh exec = ~/.dotfiles/polybar/polybar-scripts/updates-aurhelper/updates-aurhelper.sh
interval = 600 interval = 600
[module/reboot-check] [module/reboot-check]

View File

@ -1,14 +0,0 @@
# Contributing to polybar-scripts
Thank you for your interest in improving polybar-scripts.
Some things that have become standard:
* The [skeleton](skeleton/). This is an example of how each script is organized to create a common file structure.
* Use `#` or `#1`, `#2` .. as icon replacement in your scripts. Everyone use another icon font. So let the user decide which icon he wants to use.
* Remove your colors unless they have a special function. This way scripts remain customizable.
## check your code
* Use `shellcheck` to check your shell scripts for possible errors. Otherwise, Travis CI will do it for you. A good start to try [ShellCheck](https://www.shellcheck.net/) is their website.

View File

@ -1,24 +0,0 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>

View File

@ -1,125 +1 @@
# polybar-scripts These are local copies of the scripts found on the polybar-scripts (https://github.com/polybar/polybar-scripts.git) repo. Modified to fit the local system. Pull changes of the repo to ~/.config/polybar-scripts and vimdiff between the local copies to see if there's updates.
[![Codecheck](https://github.com/polybar/polybar-scripts/workflows/Codecheck/badge.svg?branch=master)](https://github.com/polybar/polybar-scripts/actions)
[![GitHub contributors](https://img.shields.io/github/contributors/polybar/polybar-scripts.svg)](https://github.com/polybar/polybar-scripts/graphs/contributors)
[![license](https://img.shields.io/github/license/polybar/polybar-scripts.svg)](https://github.com/polybar/polybar-scripts/blob/master/LICENSE)
This is a community project. We write and collect scripts for Polybar!
To find out how to write and use your own scripts, read [Polybars wiki](https://github.com/jaagr/polybar/wiki).
This repository is not an exact blueprint. I guess every script has to be customized to make your Polybar unique. We cannot guarantee that all scripts will work because many scripts are written for very specific purposes. But we're trying.
Your script isn't here yet? You have ideas to extend the scripts or descriptions? Send us your pull request or join us on freenode's `#polybar`.
## Hall of Fame
Is this your first time here? You should definitely take a look at these scripts:
* [openweathermap-fullfeatured](polybar-scripts/openweathermap-fullfeatured)
* [player-mpris-tail](polybar-scripts/player-mpris-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)
* [updates-pacman-aurhelper](polybar-scripts/updates-pacman-aurhelper)
* [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
[![updates-pacman-aurhelper](polybar-scripts/updates-pacman-aurhelper/screenshots/1.png)](polybar-scripts/updates-pacman-aurhelper/)
[![system-cpu-temppercore](polybar-scripts/system-cpu-temppercore/screenshots/1.png)](polybar-scripts/system-cpu-temppercore/)
[![notification-chess](polybar-scripts/notification-chess/screenshots/1.png)](polybar-scripts/notification-chess/)
[![notification-reddit](polybar-scripts/notification-reddit/screenshots/1.png)](polybar-scripts/notification-reddit/)
[![vpn-openvpn-isrunning](polybar-scripts/vpn-openvpn-isrunning/screenshots/1.png)](polybar-scripts/vpn-openvpn-isrunning/)
[![inbox-imap-pythongpg](polybar-scripts/inbox-imap-pythongpg/screenshots/1.png)](polybar-scripts/inbox-imap-pythongpg/)
[![openweathermap-fullfeatured](polybar-scripts/openweathermap-fullfeatured/screenshots/1.png)](polybar-scripts/openweathermap-fullfeatured/)
[![ticker-crypto](polybar-scripts/ticker-crypto/screenshots/1.png)](polybar-scripts/ticker-crypto/)
[![info-docker](polybar-scripts/info-docker/screenshots/1.png)](polybar-scripts/info-docker/)
[![easteregg-pornhub](polybar-scripts/easteregg-pornhub/screenshots/1.png)](polybar-scripts/easteregg-pornhub/)
[![info-airqualityindex](polybar-scripts/info-airqualityindex/screenshots/1.png)](polybar-scripts/info-airqualityindex/)
[![player-mpris-simple](polybar-scripts/player-mpris-simple/screenshots/1.png)](polybar-scripts/player-mpris-simple/)
[![battery-combined-tlp](polybar-scripts/battery-combined-tlp/screenshots/1.png)](polybar-scripts/battery-combined-tlp/)
[![info-projecthamster](polybar-scripts/info-projecthamster/screenshots/1.png)](polybar-scripts/info-projecthamster/)
[![system-usb-udev](polybar-scripts/system-usb-udev/screenshots/1.png)](polybar-scripts/system-usb-udev/)
[![system-usb-udev](polybar-scripts/system-usb-udev/screenshots/2.png)](polybar-scripts/system-usb-udev/)
[![openweathermap-simple](polybar-scripts/openweathermap-simple/screenshots/1.png)](polybar-scripts/openweathermap-simple/)
[![info-pingrtt](polybar-scripts/info-pingrtt/screenshots/3.png)](polybar-scripts/info-pingrtt/)
[![info-ssh-sessions](polybar-scripts/info-ssh-sessions/screenshots/1.png)](polybar-scripts/info-ssh-sessions/)
[![openweathermap-detailed](polybar-scripts/openweathermap-detailed/screenshots/1.png)](polybar-scripts/openweathermap-detailed/)
[![info-hackspeed](polybar-scripts/info-hackspeed/screenshots/1.png)](polybar-scripts/info-hackspeed/)
[![info-xampp](polybar-scripts/info-xampp/screenshots/1.png)](polybar-scripts/info-xampp/)
[![info-taskspooler](polybar-scripts/info-taskspooler/screenshots/1.png)](polybar-scripts/info-taskspooler/)
[![network-publicip](polybar-scripts/network-publicip/screenshots/1.png)](polybar-scripts/network-publicip/)
[![system-thinklight](polybar-scripts/system-thinklight/screenshots/1.png)](polybar-scripts/system-thinklight/)
[![player-mpris-tail](polybar-scripts/player-mpris-tail/screenshots/1.png)](polybar-scripts/player-mpris-tail/)
[![info-redshift-temp](polybar-scripts/info-redshift-temp/screenshots/1.png)](polybar-scripts/info-redshift-temp/)
[![info-trash](polybar-scripts/info-trash/screenshots/1.png)](polybar-scripts/info-trash/)
[![vpn-wireguard-wg](polybar-scripts/vpn-wireguard-wg/screenshots/1.png)](polybar-scripts/vpn-wireguard-wg/)
[![vpn-wireguard-wg](polybar-scripts/vpn-wireguard-wg/screenshots/2.png)](polybar-scripts/vpn-wireguard-wg/)
[![info-softwarecounter](polybar-scripts/info-softwarecounter/screenshots/1.png)](polybar-scripts/info-softwarecounter/)
[![vpn-anyconnect-status](polybar-scripts/vpn-anyconnect-status/screenshots/1.png)](polybar-scripts/vpn-anyconnect-status/)
[![player-cmus](polybar-scripts/player-cmus/screenshots/1.png)](polybar-scripts/player-cmus/)
[![info-todotxt](polybar-scripts/info-todotxt/screenshots/1.png)](polybar-scripts/info-todotxt/)
[![vpn-networkmanager-status](polybar-scripts/vpn-networkmanager-status/screenshots/1.png)](polybar-scripts/vpn-networkmanager-status/)
[![info-wifionice](polybar-scripts/info-wifionice/screenshots/1.png)](polybar-scripts/info-wifionice/)
[![network-localip](polybar-scripts/network-localip/screenshots/1.png)](polybar-scripts/network-localip/)
[![updates-dnf](polybar-scripts/updates-dnf/screenshots/1.png)](polybar-scripts/updates-dnf/)
[![system-eprivacy](polybar-scripts/system-eprivacy/screenshots/1.png)](polybar-scripts/system-eprivacy/)
[![network-ipinfo.io](polybar-scripts/network-ipinfo.io/screenshots/1.png)](polybar-scripts/network-ipinfo.io/)
[![system-gpu-optimus](polybar-scripts/system-gpu-optimus/screenshots/1.png)](polybar-scripts/system-gpu-optimus/)
[![info-tmux-sessions](polybar-scripts/info-tmux-sessions/screenshots/1.png)](polybar-scripts/info-tmux-sessions/)
[![info-hlwm-workspaces](polybar-scripts/info-hlwm-workspaces/screenshots/1.png)](polybar-scripts/info-hlwm-workspaces/)
[![info-hexdate](polybar-scripts/info-hexdate/screenshots/1.png)](polybar-scripts/info-hexdate/)
[![notification-spacex](polybar-scripts/notification-spacex/screenshots/1.png)](polybar-scripts/notification-spacex/)
## 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/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
* [DRKblade/polybar-warrior](https://github.com/DRKblade/polybar-warrior): A script to browse through your tasks and mark them as done.
* [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
* [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
* [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
* [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
* [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
* [Jvanrhijn/polybar-spotify](https://github.com/Jvanrhijn/polybar-spotify): Shows the current song playing on Spotify
* [HackeSta/polybar-browsermediacontrol](https://github.com/HackeSta/polybar-browsermediacontrol): Browser Media Control module for Polybar
* [dietervanhoof/polybar-spotify-controls](https://github.com/dietervanhoof/polybar-spotify-controls): Set of modules provides controls for spotify
* [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

View File

@ -50,6 +50,7 @@ The following arguments are supported:
Argument | Description | Default Argument | Description | Default
---|---|--- ---|---|---
-b, --blacklist | Blacklist / Ignore the given player -b, --blacklist | Blacklist / Ignore the given player
-w, --whitelist | Whitelist / Permit the given player
-f, --format | Use the given `format` string | `{icon} {artist} - {title}` -f, --format | Use the given `format` string | `{icon} {artist} - {title}`
--truncate-text | Use the given string as the end of truncated text | `…` --truncate-text | Use the given string as the end of truncated text | `…`
--icon-playing | Use the given text as the playing icon | `⏵` --icon-playing | Use the given text as the playing icon | `⏵`
@ -74,6 +75,7 @@ album | The album of the current track
title | The title of the current track title | The title of the current track
track | The track number of the current track track | The track number of the current track
length | The length of the current track length | The length of the current track
fmt-length | The formatted length of the current track ([hours:]minutes:seconds)
genre | The genre of the current track genre | The genre of the current track
disc | The disc number of the current track disc | The disc number of the current track
date | The date of the current track date | The date of the current track

View File

@ -19,8 +19,9 @@ FORMAT_TAG_REGEX = re.compile(r'(?P<format>[wt])(?P<formatlen>\d+)')
SAFE_TAG_REGEX = re.compile(r'[{}]') SAFE_TAG_REGEX = re.compile(r'[{}]')
class PlayerManager: class PlayerManager:
def __init__(self, blacklist = [], connect = True): def __init__(self, filter_list, block_mode = True, connect = True):
self.blacklist = blacklist self.filter_list = filter_list
self.block_mode = block_mode
self._connect = connect self._connect = connect
self._session_bus = dbus.SessionBus() self._session_bus = dbus.SessionBus()
self.players = {} self.players = {}
@ -78,7 +79,12 @@ class PlayerManager:
return player_bus_name return player_bus_name
def busNameIsAPlayer(self, bus_name): def busNameIsAPlayer(self, bus_name):
return bus_name.startswith('org.mpris.MediaPlayer2') and bus_name.split('.')[3] not in self.blacklist if bus_name.startswith('org.mpris.MediaPlayer2') is False:
return False
name = bus_name.split('.')[3]
if self.block_mode is True:
return name not in self.filter_list
return name in self.filter_list
def refreshPlayerList(self): def refreshPlayerList(self):
player_bus_names = [ bus_name for bus_name in self._session_bus.list_names() if self.busNameIsAPlayer(bus_name) ] player_bus_names = [ bus_name for bus_name in self._session_bus.list_names() if self.busNameIsAPlayer(bus_name) ]
@ -275,6 +281,11 @@ class Player:
_disc = _getProperty(self._metadata, 'xesam:discNumber', '') _disc = _getProperty(self._metadata, 'xesam:discNumber', '')
_length = _getProperty(self._metadata, 'xesam:length', 0) or _getProperty(self._metadata, 'mpris:length', 0) _length = _getProperty(self._metadata, 'xesam:length', 0) or _getProperty(self._metadata, 'mpris:length', 0)
_length_int = _length if type(_length) is int else int(float(_length)) _length_int = _length if type(_length) is int else int(float(_length))
_fmt_length = ( # Formats using h:mm:ss if length > 1 hour, else m:ss
f'{_length_int/1e6//60:.0f}:{_length_int/1e6%60:02.0f}'
if _length_int < 3600*1e6 else
f'{_length_int/1e6//3600:.0f}:{_length_int/1e6%3600//60:02.0f}:{_length_int/1e6%60:02.0f}'
)
_date = _getProperty(self._metadata, 'xesam:contentCreated', '') _date = _getProperty(self._metadata, 'xesam:contentCreated', '')
_year = _date[0:4] if len(_date) else '' _year = _date[0:4] if len(_date) else ''
_url = _getProperty(self._metadata, 'xesam:url', '') _url = _getProperty(self._metadata, 'xesam:url', '')
@ -292,6 +303,7 @@ class Player:
self.metadata['url'] = _url self.metadata['url'] = _url
self.metadata['filename'] = os.path.basename(_url) self.metadata['filename'] = os.path.basename(_url)
self.metadata['length'] = _length_int self.metadata['length'] = _length_int
self.metadata['fmt-length'] = _fmt_length
self.metadata['cover'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_cover)) self.metadata['cover'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_cover))
self.metadata['duration'] = _duration self.metadata['duration'] = _duration
@ -483,7 +495,11 @@ parser.add_argument('command', help="send the given command to the active player
choices=[ 'play', 'pause', 'play-pause', 'stop', 'previous', 'next', 'status', 'list', 'current', 'metadata', 'raise' ], choices=[ 'play', 'pause', 'play-pause', 'stop', 'previous', 'next', 'status', 'list', 'current', 'metadata', 'raise' ],
default=None, default=None,
nargs='?') nargs='?')
parser.add_argument('-b', '--blacklist', help="ignore a player by it's bus name. Can be be given multiple times (e.g. -b vlc -b audacious)", parser.add_argument('-b', '--blacklist', help="ignore a player by it's bus name. Can be given multiple times (e.g. -b vlc -b audacious)",
action='append',
metavar="BUS_NAME",
default=[])
parser.add_argument('-w', '--whitelist', help="permit a player by it's bus name like --blacklist. will block --blacklist if given",
action='append', action='append',
metavar="BUS_NAME", metavar="BUS_NAME",
default=[]) default=[])
@ -504,10 +520,13 @@ ICON_PAUSED = args.icon_paused
ICON_STOPPED = args.icon_stopped ICON_STOPPED = args.icon_stopped
ICON_NONE = args.icon_none ICON_NONE = args.icon_none
block_mode = len(args.whitelist) == 0
filter_list = args.blacklist if block_mode else args.whitelist
if args.command is None: if args.command is None:
PlayerManager(blacklist = args.blacklist) PlayerManager(filter_list = filter_list, block_mode = block_mode)
else: else:
player_manager = PlayerManager(blacklist = args.blacklist, connect = False) player_manager = PlayerManager(filter_list = filter_list, block_mode = block_mode, connect = False)
current_player = player_manager.getCurrentPlayer() current_player = player_manager.getCurrentPlayer()
if args.command == 'play' and current_player: if args.command == 'play' and current_player:
current_player.play() current_player.play()

View File

@ -1,15 +0,0 @@
# Script: battery-combined-shell
A shell script that shows the battery status.
It supports two rechargeable batteries and changing icons. It works even if only one battery is used.
## Module
```ini
[module/battery-combined-shell]
type = custom/script
exec = ~/polybar-scripts/battery-combined-shell.sh
interval = 10
```

View File

@ -1,61 +0,0 @@
#!/bin/sh
PATH_AC="/sys/class/power_supply/AC"
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
ac=0
battery_level_0=0
battery_level_1=0
battery_max_0=0
battery_max_1=0
if [ -f "$PATH_AC/online" ]; then
ac=$(cat "$PATH_AC/online")
fi
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
fi
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
fi
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
fi
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
fi
battery_level=$(("$battery_level_0 + $battery_level_1"))
battery_max=$(("$battery_max_0 + $battery_max_1"))
battery_percent=$(("$battery_level * 100"))
battery_percent=$(("$battery_percent / $battery_max"))
if [ "$ac" -eq 1 ]; then
icon="#1"
if [ "$battery_percent" -gt 97 ]; then
echo "$icon"
else
echo "$icon $battery_percent %"
fi
else
if [ "$battery_percent" -gt 85 ]; then
icon="#21"
elif [ "$battery_percent" -gt 60 ]; then
icon="#22"
elif [ "$battery_percent" -gt 35 ]; then
icon="#23"
elif [ "$battery_percent" -gt 10 ]; then
icon="#24"
else
icon="#25"
fi
echo "$icon $battery_percent %"
fi

View File

@ -1,31 +0,0 @@
# Script: battery-combined-tlp
A shell script that shows the battery status.
It uses TLP and requires root privileges. Note that the icon doesn't change.
![battery-combined-tlp](screenshots/1.png)
## Dependencies
* `tlp`
## Configuration
You have to add the `tlp-stat` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /usr/bin/tlp-stat
```
## Module
```ini
[module/battery-combined-tlp]
type = custom/script
exec = ~/polybar-scripts/battery-combined-tlp.sh
interval = 10
```

View File

@ -1,5 +0,0 @@
#!/bin/sh
battery=$(sudo tlp-stat -b | tac | grep -m 1 "Charge" | tr -d -c "[:digit:],.")
echo "# $battery %"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

View File

@ -1,4 +0,0 @@
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", \
RUN+="/home/user/.config/polybar/battery-combined-udev.sh --update"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", \
RUN+="/home/user/.config/polybar/battery-combined-udev.sh --update"

View File

@ -1,22 +0,0 @@
# Script: battery-combined-udev
A shell script that shows the battery status. This is an extended version of [battery-combined-shell](../battery-combined-shell).
It supports two rechargeable batteries and changing icons. It works even if only one battery is used.
This script is able to display power supply changes in real time. For this udev is being used.
## Configuration
Copy `95-battery.rules` to `/etc/udev/rules.d/95-battery.rules`. Make sure that the paths in the file have been modified properly.
## Module
```ini
[module/battery-combined-udev]
type = custom/script
exec = ~/polybar-scripts/battery-combined-udev.sh
tail = true
```

View File

@ -1,88 +0,0 @@
#!/bin/sh
battery_print() {
PATH_AC="/sys/class/power_supply/AC"
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
ac=0
battery_level_0=0
battery_level_1=0
battery_max_0=0
battery_max_1=0
if [ -f "$PATH_AC/online" ]; then
ac=$(cat "$PATH_AC/online")
fi
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
fi
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
fi
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
fi
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
fi
battery_level=$(("$battery_level_0 + $battery_level_1"))
battery_max=$(("$battery_max_0 + $battery_max_1"))
battery_percent=$(("$battery_level * 100"))
battery_percent=$(("$battery_percent / $battery_max"))
if [ "$ac" -eq 1 ]; then
icon="#1"
if [ "$battery_percent" -gt 97 ]; then
echo "$icon"
else
echo "$icon $battery_percent %"
fi
else
if [ "$battery_percent" -gt 85 ]; then
icon="#21"
elif [ "$battery_percent" -gt 60 ]; then
icon="#22"
elif [ "$battery_percent" -gt 35 ]; then
icon="#23"
elif [ "$battery_percent" -gt 10 ]; then
icon="#24"
else
icon="#25"
fi
echo "$icon $battery_percent %"
fi
}
path_pid="/tmp/polybar-battery-combined-udev.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
battery_print
sleep 30 &
wait
done
;;
esac

View File

@ -1,29 +0,0 @@
# Script: battery-cyberpower
A shell script that shows the battery status for CyberPower UPS devices.
This script is able to display power supply changes in real time.
## Dependencies
* `pwrstat` from CyberPower's website
## Configuration
You have to add the `pwrstat` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /usr/bin/pwrstat
```
## Module
```ini
[module/battery-cyberpower]
type = custom/script
exec = ~/polybar-scripts/battery-cyberpower.sh
tail = true
```

View File

@ -1,56 +0,0 @@
#!/bin/sh
ICON_AC="#1"
ICON_BATTERY_FULL="#21"
ICON_BATTERY_GOOD="#22"
ICON_BATTERY_LOW="#23"
ICON_BATTERY_CAUTION="#24"
ICON_BATTERY_EMPTY="#25"
SHOW_ESTIMATION=1
battery_print() {
battery_info="$(sudo pwrstat -status)"
battery_capacity="$(echo "$battery_info" | awk '/Capacity/{print $3}')"
battery_ac="$(echo "$battery_info" | awk '/Power Supply by/{print $4,$5}')"
battery_load="$(echo "$battery_info" | grep "Load" | cut -d \( -f 2 | tr -d ' %)')"
battery_remaining="$(echo "$battery_info" | awk '/Remaining Runtime/{print $3}')"
output=""
if [ "$battery_ac" = "Utility Power" ]; then
if [ "$battery_capacity" -gt 97 ]; then
output="$ICON_AC"
else
output="$ICON_AC $battery_capacity %"
fi
else
if [ "$battery_capacity" -gt 85 ]; then
output="$ICON_BATTERY_FULL $battery_capacity %"
elif [ "$battery_capacity" -gt 60 ]; then
output="$ICON_BATTERY_GOOD $battery_capacity %"
elif [ "$battery_capacity" -gt 35 ]; then
output="$ICON_BATTERY_LOW $battery_capacity %"
elif [ "$battery_capacity" -gt 10 ]; then
output="$ICON_BATTERY_CAUTION $battery_capacity %"
else
output="$ICON_BATTERY_EMPTY $battery_capacity %"
fi
fi
if [ "$SHOW_ESTIMATION" -eq 1 ]; then
output="$output ($battery_load % / $battery_remaining min)"
fi
echo "$output"
}
trap exit INT
trap "echo" USR1
while true; do
battery_print "$@"
sleep 30 &
wait
done

View File

@ -1,44 +0,0 @@
# Script: easteregg-pornhub
A script that shows a button and opens a random video at a large porn website.
![easteregg-pornhub](screenshots/1.png)
## 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
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,29 +0,0 @@
# Script: inbox-imap-pythongpg
A script that shows if there are unread mails in your IMAPs inbox. Passwords are encrypted with gpg.
![inbox-imap-pythongpg](screenshots/1.png)
## 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
```

View File

@ -1,14 +0,0 @@
#!/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()))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

View File

@ -1,27 +0,0 @@
# Script: inbox-imap-shellnetrc
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 is stored in a `.netrc`. This is more secure because the password is not visible in the process list.
## Dependencies
* `curl`
## Configuration
For Gmail, you must allow [less secure apps](https://myaccount.google.com/security#connectedapps).
## Module
```ini
[module/inbox-imap-shellnetrc]
type = custom/script
exec = ~/polybar-scripts/inbox-imap-shellnetrc.sh
interval = 60
```

View File

@ -1,3 +0,0 @@
machine mail.server.tld
login username
password supersecretpw

View File

@ -1,12 +0,0 @@
#!/bin/sh
SERVER=""
NETRC=".netrc"
inbox=$(curl -sf --netrc-file "$NETRC" -X "STATUS INBOX (UNSEEN)" imaps://"$SERVER"/INBOX | tr -d -c "[:digit:]")
if [ "$inbox" ] && [ "$inbox" -gt 0 ]; then
echo "# $inbox"
else
echo ""
fi

View File

@ -1,22 +0,0 @@
# 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
```

View File

@ -1,19 +0,0 @@
#!/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

View File

@ -1,22 +0,0 @@
# Script: inbox-pop3-shellnetrc
A script that shows if there are unread mails in your POP3 inbox.
This script actually use POP3s. `curl` can also handle unencrypted POP3. You only need to change the protocol in the command.
The login data is stored in a `.netrc`. This is more secure because the password is not visible in the process list.
## Dependencies
* `curl`
## Module
```ini
[module/inbox-pop3-shellnetrc]
type = custom/script
exec = ~/polybar-scripts/inbox-pop3-shellnetrc.sh
interval = 60
```

View File

@ -1,3 +0,0 @@
machine mail.server.tld
login username
password supersecretpw

View File

@ -1,12 +0,0 @@
#!/bin/sh
SERVER=""
NETRC=".netrc"
inbox=$(curl -sf --netrc-file "$NETRC" pop3s://"$SERVER" | wc -l)
if [ "$inbox" -gt 0 ]; then
echo "# $inbox"
else
echo ""
fi

View File

@ -1,30 +0,0 @@
# Script: info-airqualityindex
A script that shows the local World Air Quality Index. It's an indicator for the air pollution.
![info-airqualityindex](screenshots/1.png)
## 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
```

View File

@ -1,41 +0,0 @@
#!/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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,26 +0,0 @@
# Script: info-docker
Shows the number of Docker containers in one of the states: `created`, `restarting`, `running`, `removing`, `paused`, `exited`, `dead`
![info-docker](screenshots/1.png)
## 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
```

View File

@ -1,9 +0,0 @@
#!/bin/sh
STATUS="running exited dead"
for stat in $STATUS; do
output="$output $(sudo docker ps -qf status="$stat" | wc -l) |"
done
echo "|$output"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

View File

@ -1,20 +0,0 @@
# Script: info-dualshock4
A shell script that shows the battery level of a DualShock 4 Controller.
![info-dualshock4](screenshots/1.png)
## 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
```

View File

@ -1,5 +0,0 @@
#!/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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,18 +0,0 @@
# 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
```

View File

@ -1,12 +0,0 @@
#!/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")

View File

@ -1,15 +0,0 @@
# 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
```

View File

@ -1,10 +0,0 @@
#!/bin/sh
time=$((20 - $(date '+%-M') % 20))
#if [ $time -eq 20 ]; then
# notify-send 'Break' &
# ogg123 beep.ogg &> /dev/null &
#fi
echo "$time"

View File

@ -1,25 +0,0 @@
# Script: info-gitlab-pipelines
Displays the number of succeeded, running and failed gitlab-pipelines triggered by a user.
![info-gitlab-pipelines](screenshots/1.png)
## 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
...

View File

@ -1,23 +0,0 @@
#!/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-}|"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

View File

@ -1,15 +0,0 @@
# Script: info-hexdate
Print the current date in a hex format.
![info-hexdate](screenshots/1.png)
## Module
```ini
[module/info-hexdate]
type = custom/script
exec = ~/polybar-scripts/info-hexdate.sh
interval = 60
```

View File

@ -1,11 +0,0 @@
#!/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"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,27 +0,0 @@
# Script: info-hlwm-workspaces
Displays all herbstluftwm workspaces with support for all workspace states (`focused`, `visible`, `occupied`, `empty`, `urgent`).
![info-hlwm-workspaces](screenshots/1.png)
## 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 &
```

View File

@ -1,46 +0,0 @@
#!/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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,13 +0,0 @@
# Script: info-kernel
A script that shows the running kernel version.
## Module
```ini
[module/info-kernel]
type = custom/script
exec = uname -r
interval = 1024
```

View File

@ -1,17 +0,0 @@
# Script: info-pingrtt
A script that displays a ping result. It also shows a colored icon.
![info-pingrtt](screenshots/1.png)
![info-pingrtt](screenshots/2.png)
![info-pingrtt](screenshots/3.png)
## Module
```ini
[module/info-pingrtt]
type = custom/script
exec = ~/polybar-scripts/info-pingrtt.sh
interval = 10
```

View File

@ -1,19 +0,0 @@
#!/bin/sh
HOST=127.43.12.64
if ! ping=$(ping -n -c 1 -W 1 $HOST); then
echo "# ping failed"
else
rtt=$(echo "$ping" | sed -rn 's/.*time=([0-9]{1,})\.?[0-9]{0,} ms.*/\1/p')
if [ "$rtt" -lt 50 ]; then
icon="%{F#3cb703}#%{F-}"
elif [ "$rtt" -lt 150 ]; then
icon="%{F#f9dd04}#%{F-}"
else
icon="%{F#d60606}#%{F-}"
fi
echo "$icon $rtt ms"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

View File

@ -1,15 +0,0 @@
# Script: info-projecthamster
This script displays Hamster Time Tracker information.
![info-projecthamster](screenshots/1.png)
## Module
```ini
[module/info-projecthamster]
type = custom/script
exec = ~/polybar-scripts/info-projecthamster.sh
interval = 5
```

View File

@ -1,9 +0,0 @@
#!/bin/sh
activity=$(hamster current 2> /dev/null | cut -d " " -f 3- | sed 's/@.* / - /')
if [ -n "$activity" ]; then
echo "$activity"
else
echo "No Activity"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,15 +0,0 @@
# Script: info-redshift-temp
This script displays the current color temperature.
![info-redshift](screenshots/1.png)
## Module
```ini
[module/info-redshift-temp]
type = custom/script
exec = ~/polybar-scripts/info-redshift-temp.sh
interval = 5
```

View File

@ -1,15 +0,0 @@
#!/bin/sh
if [ "$(pgrep -x redshift)" ]; then
temp=$(redshift -p 2> /dev/null | grep temp | cut -d ":" -f 2 | tr -dc "[:digit:]")
if [ -z "$temp" ]; then
echo "%{F#65737E} #"
elif [ "$temp" -ge 5000 ]; then
echo "%{F#8FA1B3} #"
elif [ "$temp" -ge 4000 ]; then
echo "%{F#EBCB8B} #"
else
echo "%{F#D08770} #"
fi
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

View File

@ -1,25 +0,0 @@
# Script: info-softwarecounter
A script that counts the number of specified running software including GUIs and processes.
Options to only monitor GUI applications or only processes exist. Users can add their own applications or processes they wish to watch simply by updating the existing dictionaries at the start of the script.
Arbitrary program counts can be combined, for example, the vim/nvim or chrome/chromium counts can be added together and the total displayed.
![info-softwarecounter](screenshots/1.png)
## Dependencies
* `wmctrl`
* `pgrep`
## Module
```
[module/info-softwarecounter]
type = custom/script
exec = ~/polybar-scripts/info-softwarecounter.py
interval = 10
```

View File

@ -1,145 +0,0 @@
#!/usr/bin/env python3
import subprocess
import sys
from collections import Counter, OrderedDict
# update GUIs
GUI = True
# update processes
PROCESS = True
# program/process names and corresponding gylphs
guis = OrderedDict({
'terminals': '#',
'chromes': '#',
'firefox': '#',
'skypeforlinux': '#',
'filemanager': '#',
'remote-desktop': '#',
'pdfviewer': '#',
'image': '#',
})
processes = OrderedDict({
'vims': '#',
'ssh': '#',
'updater': '#',
})
# combine counts of program/process names in the tuple
# the resulting glpyh used will be that of the corresponding key
combine_guis = {
'terminals': ('termite', 'terminator', 'urxvt'),
'chromes': ('chromium', 'chrome'),
'filemanger': ('nemo', 'thunar', 'dolphin', 'nautilus', 'pcmanfm'),
'remote-desktop': ('TeamViewer', ),
'pdfviewer': ('evince', 'okular', 'zathura'),
'image': ('gthumb', 'shotwell', 'deepin-image-vi'),
}
combine_proccesses = {
'vims': ('nvim', 'vim'),
'updater': ('pacman', 'yay', 'trizen', 'yaourt'),
}
gui_output = ''
process_output = ''
if GUI:
def get_running_guis():
try:
listed = sys.argv[1]
except IndexError:
listed = []
get = lambda cmd: subprocess.check_output(cmd).decode("utf-8").strip()
def check_wtype(w_id):
# check the type of window, only list "NORMAL" windows
return "_NET_WM_WINDOW_TYPE_NORMAL" in get(["xprop", "-id", w_id])
def get_process(w_id):
# get the name of the process, owning the window
proc = get(["ps", "-p", w_id, "-o", "comm="])
return proc
wlist = [l.split() for l in subprocess.check_output(["wmctrl", "-lp"])\
.decode("utf-8").splitlines()]
validprocs = [
get_process(w[2]) for w in wlist if check_wtype(w[0]) == True and w[2] != '0'
]
return validprocs
# get list of running GUI programs
gui_counts = Counter(get_running_guis())
# combine programs in program combine list
for k, lst in combine_guis.items():
count = 0
for i in lst:
try:
count += gui_counts.pop(i)
except KeyError:
pass
if count:
gui_counts[k] += count
# generate program output
for k, v in guis.items():
try:
c = gui_counts[k]
if c:
gui_output += '%s %i ' % (v, c)
except:
pass
if PROCESS:
def get_running_proc(process_name_list):
counts = [None] * len(process_name_list)
for i, p in enumerate(process_name_list):
try:
count = int(
subprocess.check_output(['pgrep', '-c', '-x',
p]).decode('utf-8'))
except subprocess.CalledProcessError:
count = 0
counts[i] = (p, count)
return dict(counts)
# count running proccesses
process_counts = get_running_proc(processes.keys())
combine_counts = get_running_proc(
list(sum(combine_proccesses.values(), ())))
process_counts.update(combine_counts)
# combine processes in process combine list
for k, lst in combine_proccesses.items():
count = 0
for i in lst:
try:
count += process_counts.pop(i)
except KeyError:
pass
if count:
process_counts[k] += count
# generate process output
for k, v in processes.items():
try:
c = process_counts[k]
if c:
process_output += '%s %i ' % (v, c)
except:
pass
print(gui_output + process_output)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -1,20 +0,0 @@
# Script: info-ssh-sessions
A script that displays the count of current ssh sessions as well as the public IP address of the fist session.
![info-ssh-sessions](screenshots/1.png)
## Dependencies
* `lsof`
## Module
```ini
[module/info-ssh-sessions]
type = custom/script
exec = ~/polybar-scripts/info-ssh-sessions.sh
interval = 5
```

View File

@ -1,10 +0,0 @@
#!/bin/sh
sessions="$(lsof -Pi | grep ":22")"
if [ -n "$sessions" ]; then
count=$(echo "$sessions" | wc -l)
echo "# ($count): $(echo "$sessions" | cut -d ">" -f 2 | cut -d " " -f 1 | cut -d ":" -f 1 | tail -n 1)"
else
echo "# (0)"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,28 +0,0 @@
# Script: info-taskspooler
A small script that displays the number of queues/runtimes for one or more task spooler servers.
![info-taskspooler](screenshots/1.png)
## 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
```

View File

@ -1,27 +0,0 @@
#!/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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,16 +0,0 @@
# Script: info-tmux-sessions
A simple script to show tmux sessions.
![info-tmux-sessions](screenshots/1.png)
![info-tmux-sessions](screenshots/2.png)
## Module
```ini
[module/info-tmux-sessions]
type = custom/script
exec = ~/polybar-scripts/info-tmux-sessions.sh
interval = 5
```

View File

@ -1,21 +0,0 @@
#! /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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,15 +0,0 @@
# Script: info-todotxt
A script that shows todo.txt items due. The first column shows items due today, and the second column shows items due this week (including today).
![todotxt](screenshots/1.png)
## Module
```ini
[module/info-todotxt]
type = custom/script
exec = ~/polybar-scripts/info-todotxt.sh
interval = 60
```

View File

@ -1,16 +0,0 @@
#!/bin/sh
duetoday=$(grep "due:$(date -I)" ~/todo.txt | grep -c -v "x")
dueweek=0
weekday=0
while [ "$weekday" -le 7 ]; do
dueweek=$((dueweek + $(grep "due:$(date -I --date="$weekday day")" ~/todo.txt | grep -c -v "x")))
weekday=$(( weekday + 1 ))
done
if [ "$dueweek" -gt 0 ]; then
echo "#1 $duetoday $dueweek"
else
echo "#2"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

View File

@ -1,16 +0,0 @@
# Script: info-trash
This script count the files in you trash directory.
![info-trash](screenshots/1.png)
## Module
```ini
[module/info-trash]
type = custom/script
exec = ~/polybar-scripts/info-trash.sh
interval = 60
click-left = ~/polybar-scripts/info-trash.sh --clean &
```

View File

@ -1,13 +0,0 @@
#!/bin/sh
case "$1" in
--clean)
rm -rf ~/.local/share/Trash/files
rm -rf ~/.local/share/Trash/info
mkdir ~/.local/share/Trash/files
mkdir ~/.local/share/Trash/info
;;
*)
find ~/.local/share/Trash/files/ -maxdepth 1 | wc -l
;;
esac

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

View File

@ -1,4 +0,0 @@
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"

View File

@ -1,20 +0,0 @@
# 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
```

View File

@ -1,44 +0,0 @@
#!/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

View File

@ -1,20 +0,0 @@
# Script: info-wifionice
This script shows some information about the current ICE train of Deutsche Bahn. It requests the data from the local information portal and was obviously hacked in a train.
![info-wifionice](screenshots/1.png)
## Dependencies
* You have to be logged in to the local SSID `WIFIonICE`.
## Module
```ini
[module/info-wifionice]
type = custom/script
exec = ~/polybar-scripts/info-wifionice.sh
interval = 10
```

View File

@ -1,34 +0,0 @@
#!/bin/sh
if [ "$(iwgetid -r)" = "WIFIonICE" ]; then
wifionice=$(curl -sf https://iceportal.de/api1/rs/status)
if [ "$(echo "$wifionice" | jq .connection)" = "true" ]; then
wifionice_speed=$(echo "$wifionice" | jq .speed)
if [ "$wifionice_speed" -ne 0 ]; then
wifionice_speed=" - $wifionice_speed km/h"
else
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
else
echo ""
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,21 +0,0 @@
# Script: info-wmname
This script prints the value of the window manager name property of the root window.
The BSPWM window manger, and maybe some more, has some problems with java scaling. To solve this you can [set the value of the window manager name property](https://wiki.archlinux.org/index.php/java#Impersonate_another_window_manager) to something different.
## Dependencies
* `wmname`
## Module
```ini
[module/info-wmname]
type = custom/script
exec = ~/polybar-scripts/info-wmname.sh
interval = 5
click-left = ~/polybar-scripts/info-wmname.sh --toggle &
```

View File

@ -1,14 +0,0 @@
#!/bin/sh
case "$1" in
--toggle)
if [ "$(wmname)" != "BSPWM" ]; then
wmname BSPWM
else
wmname LG3D
fi
;;
*)
echo "# $(wmname)"
;;
esac

View File

@ -1,24 +0,0 @@
# Script: info-xampp
The Script prints the status of [XAMPP](https://www.apachefriends.org/de/index.html) services (Apache, MySQL, ProFTPD) if they are running.
![info-xampp](screenshots/1.png)
## Configuration
You have to add the `xampp` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /opt/lampp/xampp
```
## Module
```ini
[module/info-xampp]
type = custom/script
exec = ~/polybar-scripts/info-xampp.sh
interval = 10
```

View File

@ -1,21 +0,0 @@
#!/bin/sh
if sudo /opt/lampp/xampp status | grep -q "Apache is running."; then
status_apache="#11"
else
status_apache="#12"
fi
if sudo /opt/lampp/xampp status | grep -q "MySQL is running."; then
status_mysql="#21"
else
status_mysql="#22"
fi
if sudo /opt/lampp/xampp status | grep -q "ProFTPD is running."; then
status_ftp="#31"
else
status_ftp="#32"
fi
echo "$status_apache $status_mysql $status_ftp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Some files were not shown because too many files have changed in this diff Show More