diff --git a/README.md b/README.md new file mode 100644 index 0000000..f95b9ae --- /dev/null +++ b/README.md @@ -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/` diff --git a/dot_dotfiles/README.md b/dot_dotfiles/README.md index fe2067c..e2f6694 100644 --- a/dot_dotfiles/README.md +++ b/dot_dotfiles/README.md @@ -1,7 +1,7 @@ # 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 diff --git a/dot_dotfiles/polybar/config.tmpl b/dot_dotfiles/polybar/config.tmpl index f23177e..dac7b21 100644 --- a/dot_dotfiles/polybar/config.tmpl +++ b/dot_dotfiles/polybar/config.tmpl @@ -141,7 +141,7 @@ padding-right = 2 [module/player-mpris-tail] 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 label = %output% label-foreground = ${colors.light0_hard} @@ -150,7 +150,7 @@ label-foreground = ${colors.light0_hard} type = custom/script format-prefix = " " 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 [module/obelisk-status] @@ -388,12 +388,12 @@ label = %percentage_used%% [module/updates-pacman] 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 [module/updates-aurhelper] 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 [module/reboot-check] diff --git a/dot_dotfiles/polybar/polybar-scripts/CONTRIBUTING.md b/dot_dotfiles/polybar/polybar-scripts/CONTRIBUTING.md deleted file mode 100644 index 960c401..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/CONTRIBUTING.md +++ /dev/null @@ -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. diff --git a/dot_dotfiles/polybar/polybar-scripts/LICENSE b/dot_dotfiles/polybar/polybar-scripts/LICENSE deleted file mode 100644 index cf1ab25..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/LICENSE +++ /dev/null @@ -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 diff --git a/dot_dotfiles/polybar/polybar-scripts/README.md b/dot_dotfiles/polybar/polybar-scripts/README.md index e88ed1e..a13afc4 100644 --- a/dot_dotfiles/polybar/polybar-scripts/README.md +++ b/dot_dotfiles/polybar/polybar-scripts/README.md @@ -1,125 +1 @@ -# polybar-scripts - -[![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 +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. diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/info-hackspeed/README.md b/dot_dotfiles/polybar/polybar-scripts/info-hackspeed/README.md similarity index 100% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/info-hackspeed/README.md rename to dot_dotfiles/polybar/polybar-scripts/info-hackspeed/README.md diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/info-hackspeed/executable_info-hackspeed.sh b/dot_dotfiles/polybar/polybar-scripts/info-hackspeed/executable_info-hackspeed.sh similarity index 100% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/info-hackspeed/executable_info-hackspeed.sh rename to dot_dotfiles/polybar/polybar-scripts/info-hackspeed/executable_info-hackspeed.sh diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/info-hackspeed/screenshots/1.png b/dot_dotfiles/polybar/polybar-scripts/info-hackspeed/screenshots/1.png similarity index 100% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/info-hackspeed/screenshots/1.png rename to dot_dotfiles/polybar/polybar-scripts/info-hackspeed/screenshots/1.png diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/README.md b/dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/README.md similarity index 97% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/README.md rename to dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/README.md index dc1fe25..5d23e75 100644 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/README.md +++ b/dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/README.md @@ -50,6 +50,7 @@ The following arguments are supported: Argument | Description | Default ---|---|--- -b, --blacklist | Blacklist / Ignore the given player +-w, --whitelist | Whitelist / Permit the given player -f, --format | Use the given `format` string | `{icon} {artist} - {title}` --truncate-text | Use the given string as the end of truncated text | `…` --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 track | The track number 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 disc | The disc number of the current track date | The date of the current track diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/executable_player-mpris-tail.py b/dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/executable_player-mpris-tail.py similarity index 94% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/executable_player-mpris-tail.py rename to dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/executable_player-mpris-tail.py index 9cd4900..93e7c27 100644 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/executable_player-mpris-tail.py +++ b/dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/executable_player-mpris-tail.py @@ -19,8 +19,9 @@ FORMAT_TAG_REGEX = re.compile(r'(?P[wt])(?P\d+)') SAFE_TAG_REGEX = re.compile(r'[{}]') class PlayerManager: - def __init__(self, blacklist = [], connect = True): - self.blacklist = blacklist + def __init__(self, filter_list, block_mode = True, connect = True): + self.filter_list = filter_list + self.block_mode = block_mode self._connect = connect self._session_bus = dbus.SessionBus() self.players = {} @@ -78,7 +79,12 @@ class PlayerManager: return player_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): 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', '') _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)) + _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', '') _year = _date[0:4] if len(_date) else '' _url = _getProperty(self._metadata, 'xesam:url', '') @@ -292,6 +303,7 @@ class Player: self.metadata['url'] = _url self.metadata['filename'] = os.path.basename(_url) 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['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' ], default=None, 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', metavar="BUS_NAME", default=[]) @@ -504,10 +520,13 @@ ICON_PAUSED = args.icon_paused ICON_STOPPED = args.icon_stopped 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: - PlayerManager(blacklist = args.blacklist) + PlayerManager(filter_list = filter_list, block_mode = block_mode) 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() if args.command == 'play' and current_player: current_player.play() diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/screenshots/1.png b/dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/screenshots/1.png similarity index 100% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/screenshots/1.png rename to dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/screenshots/1.png diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/screenshots/2.png b/dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/screenshots/2.png similarity index 100% rename from dot_dotfiles/polybar/polybar-scripts/polybar-scripts/player-mpris-tail/screenshots/2.png rename to dot_dotfiles/polybar/polybar-scripts/player-mpris-tail/screenshots/2.png diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-shell/README.md b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-shell/README.md deleted file mode 100644 index 37800d6..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-shell/README.md +++ /dev/null @@ -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 -``` diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-shell/battery-combined-shell.sh b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-shell/battery-combined-shell.sh deleted file mode 100644 index 9466ce2..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-shell/battery-combined-shell.sh +++ /dev/null @@ -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 diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/README.md b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/README.md deleted file mode 100644 index 0a11598..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/README.md +++ /dev/null @@ -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 -``` diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/battery-combined-tlp.sh b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/battery-combined-tlp.sh deleted file mode 100644 index 2e18b11..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/battery-combined-tlp.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -battery=$(sudo tlp-stat -b | tac | grep -m 1 "Charge" | tr -d -c "[:digit:],.") - -echo "# $battery %" diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/screenshots/1.png b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/screenshots/1.png deleted file mode 100644 index 7474a29..0000000 Binary files a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-tlp/screenshots/1.png and /dev/null differ diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/95-battery.rules b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/95-battery.rules deleted file mode 100644 index d5d31b0..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/95-battery.rules +++ /dev/null @@ -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" diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/README.md b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/README.md deleted file mode 100644 index 0fbc0ec..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/README.md +++ /dev/null @@ -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 -``` diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/battery-combined-udev.sh b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/battery-combined-udev.sh deleted file mode 100644 index 2ad7a7c..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-combined-udev/battery-combined-udev.sh +++ /dev/null @@ -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 diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-cyberpower/README.md b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-cyberpower/README.md deleted file mode 100644 index d02b2e7..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-cyberpower/README.md +++ /dev/null @@ -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 -``` diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-cyberpower/battery-cyberpower.sh b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-cyberpower/battery-cyberpower.sh deleted file mode 100644 index e3ba575..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/battery-cyberpower/battery-cyberpower.sh +++ /dev/null @@ -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 diff --git a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/easteregg-pornhub/README.md b/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/easteregg-pornhub/README.md deleted file mode 100644 index 05c0776..0000000 --- a/dot_dotfiles/polybar/polybar-scripts/polybar-scripts/easteregg-pornhub/README.md +++ /dev/null @@ -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 =