From 25bed762fce9f65d28a9bd3b1eddd1e06b167bf8 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Wed, 1 Jan 2020 14:09:10 +0100 Subject: [PATCH] [build] Remove PKGBUILD Actually is part of the AUR repo, and keeping those two files in sync is problematic. fixes #510 --- PKGBUILD | 41 ---------------------------------------- bumblebee/modules/mpd.py | 13 ++++++++++--- 2 files changed, 10 insertions(+), 44 deletions(-) delete mode 100644 PKGBUILD diff --git a/PKGBUILD b/PKGBUILD deleted file mode 100644 index 5978e4b..0000000 --- a/PKGBUILD +++ /dev/null @@ -1,41 +0,0 @@ -# Maintainer: Tobias Witek -# Contributor: Daniel M. Capella -# Contributor: spookykidmm - -pkgname=bumblebee-status -pkgver=1.8.0 -pkgrel=1 -pkgdesc='Modular, theme-able status line generator for the i3 window manager' -arch=('any') -url=https://github.com/tobi-wan-kenobi/bumblebee-status -license=('MIT') -depends=('python' 'python-netifaces' 'python-psutil' 'python-requests') -optdepends=('xorg-xbacklight: to display a displays brightness' - 'xorg-xset: enable/disable automatic screen locking' - 'libnotify: enable/disable automatic screen locking' - 'dnf: display DNF package update information' - 'xorg-setxkbmap: display/change the current keyboard layout' - 'redshift: display the redshifts current color' - 'pulseaudio: control pulseaudio sink/sources' - 'xorg-xrandr: enable/disable screen outputs' - 'pacman: display current status of pacman' - 'iputils: display a ping' - 'i3ipc-python: display titlebar' - 'fakeroot: dependency of the pacman module' - 'pytz: timezone conversion for datetimetz module' - 'tzlocal: retrieve system timezone for datetimetz module' -) -source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz") -sha512sums=('b985e6619856519a92bd1a9d2a762997e8920a0ef5007f20063fcb2f9afeb193de67e8b0737182576f79ee19b2dd3e6388bb9b987480b7bc19b537f64e9b5685') - -package() { - install -d "$pkgdir"/usr/bin \ - "$pkgdir"/usr/share/$pkgname/{bumblebee/modules,themes/icons} - ln -s /usr/share/$pkgname/$pkgname "$pkgdir"/usr/bin/$pkgname - - cd $pkgname-$pkgver - cp -a --parents $pkgname bumblebee/{,modules/}*.py themes/{,icons/}*.json $pkgdir/usr/share/$pkgname - cp -r bin $pkgdir/usr/share/$pkgname/ - - install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE -} diff --git a/bumblebee/modules/mpd.py b/bumblebee/modules/mpd.py index 330ee9d..01def8e 100644 --- a/bumblebee/modules/mpd.py +++ b/bumblebee/modules/mpd.py @@ -3,6 +3,8 @@ """Displays information about the current song in mpd. +If mpd is not running or mpc fails for some reason, it will show "n/a". + Requires the following executable: * mpc @@ -61,6 +63,7 @@ class Module(bumblebee.engine.Module): bumblebee.output.Widget(name="mpd.repeat"), ] super(Module, self).__init__(engine, config, widgets) + self._mpd_running = False if not self.parameter("host"): self._hostcmd = "" @@ -85,10 +88,13 @@ class Module(bumblebee.engine.Module): self._tags = defaultdict(lambda: '') def hidden(self): - return self._status is None + if self._mpd_running == True and + return self._mpd_running is True and self._status is None @scrollable def description(self, widget): + if not self._mpd_running: + return "n/a" return string.Formatter().vformat(self._fmt, (), self._tags) def update(self, widgets): @@ -107,6 +113,7 @@ class Module(bumblebee.engine.Module): def _load_song(self): info = "" + self._mpd_running = True try: tags = ['name', 'artist', @@ -129,8 +136,8 @@ class Module(bumblebee.engine.Module): 'mdate'] joinedtags = "\n".join(["tag {0} %{0}%".format(tag) for tag in tags]) info = bumblebee.util.execute('mpc -f ' + '"' + joinedtags + '"' + self._hostcmd) - except RuntimeError: - pass + except Exception: + self._mpd_running = False self._tags = defaultdict(lambda: '') self._status = None for line in info.split("\n"):