Revert "[build] Remove PKGBUILD"

This reverts commit 25bed762fc.
This commit is contained in:
Tobias Witek 2020-01-02 13:51:53 +01:00
parent 472b182ab8
commit a346294f99
2 changed files with 44 additions and 10 deletions

41
PKGBUILD Normal file
View file

@ -0,0 +1,41 @@
# Maintainer: Tobias Witek <tobi@tobi-wan-kenobi.at>
# Contributor: Daniel M. Capella <polycitizen@gmail.com>
# Contributor: spookykidmm <https://github.com/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
}

View file

@ -3,8 +3,6 @@
"""Displays information about the current song in mpd. """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: Requires the following executable:
* mpc * mpc
@ -63,7 +61,6 @@ class Module(bumblebee.engine.Module):
bumblebee.output.Widget(name="mpd.repeat"), bumblebee.output.Widget(name="mpd.repeat"),
] ]
super(Module, self).__init__(engine, config, widgets) super(Module, self).__init__(engine, config, widgets)
self._mpd_running = False
if not self.parameter("host"): if not self.parameter("host"):
self._hostcmd = "" self._hostcmd = ""
@ -88,13 +85,10 @@ class Module(bumblebee.engine.Module):
self._tags = defaultdict(lambda: '') self._tags = defaultdict(lambda: '')
def hidden(self): def hidden(self):
if self._mpd_running == True and return self._status is None
return self._mpd_running is True and self._status is None
@scrollable @scrollable
def description(self, widget): def description(self, widget):
if not self._mpd_running:
return "n/a"
return string.Formatter().vformat(self._fmt, (), self._tags) return string.Formatter().vformat(self._fmt, (), self._tags)
def update(self, widgets): def update(self, widgets):
@ -113,7 +107,6 @@ class Module(bumblebee.engine.Module):
def _load_song(self): def _load_song(self):
info = "" info = ""
self._mpd_running = True
try: try:
tags = ['name', tags = ['name',
'artist', 'artist',
@ -136,8 +129,8 @@ class Module(bumblebee.engine.Module):
'mdate'] 'mdate']
joinedtags = "\n".join(["tag {0} %{0}%".format(tag) for tag in tags]) joinedtags = "\n".join(["tag {0} %{0}%".format(tag) for tag in tags])
info = bumblebee.util.execute('mpc -f ' + '"' + joinedtags + '"' + self._hostcmd) info = bumblebee.util.execute('mpc -f ' + '"' + joinedtags + '"' + self._hostcmd)
except Exception: except RuntimeError:
self._mpd_running = False pass
self._tags = defaultdict(lambda: '') self._tags = defaultdict(lambda: '')
self._status = None self._status = None
for line in info.split("\n"): for line in info.split("\n"):