Merge pull request #414 from Pseudonick47/master

TWMN Module
This commit is contained in:
tobi-wan-kenobi 2019-08-01 20:31:07 +02:00 committed by GitHub
commit bba7ddfcef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 709 additions and 487 deletions

39
bumblebee/modules/twmn.py Normal file
View file

@ -0,0 +1,39 @@
#pylint: disable=C0111,R0903
"""Toggle twmn notifications."""
import bumblebee.input
import bumblebee.output
import bumblebee.engine
class Module(bumblebee.engine.Module):
def __init__(self, engine, config):
super(Module, self).__init__(engine, config,
bumblebee.output.Widget(full_text="")
)
self._paused = False
# Make sure that twmn is currently not paused
try:
bumblebee.util.execute("killall -SIGUSR2 twmnd")
except:
pass
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd=self.toggle_status
)
def toggle_status(self, event):
self._paused = not self._paused
try:
if self._paused:
bumblebee.util.execute("systemctl --user start twmnd")
else:
bumblebee.util.execute("systemctl --user stop twmnd")
except:
self._paused = not self._paused # toggling failed
def state(self, widget):
if self._paused:
return ["muted"]
return ["unmuted"]

View file

@ -2,85 +2,204 @@
"defaults": {
"padding": " "
},
"memory": { "prefix": "ram" },
"cpu": { "prefix": "cpu" },
"disk": { "prefix": "hdd" },
"dnf": { "prefix": "dnf" },
"apt": { "prefix": "apt" },
"brightness": { "prefix": "o" },
"memory": {
"prefix": "ram"
},
"cpu": {
"prefix": "cpu"
},
"disk": {
"prefix": "hdd"
},
"dnf": {
"prefix": "dnf"
},
"apt": {
"prefix": "apt"
},
"brightness": {
"prefix": "o"
},
"cmus": {
"playing": { "prefix": ">" },
"paused": { "prefix": "||" },
"stopped": { "prefix": "[]" },
"prev": { "prefix": "|<" },
"next": { "prefix": ">|" },
"shuffle-on": { "prefix": "S" },
"shuffle-off": { "prefix": "[s]" },
"repeat-on": { "prefix": "R" },
"repeat-off": { "prefix": "[r]" }
"playing": {
"prefix": ">"
},
"paused": {
"prefix": "||"
},
"stopped": {
"prefix": "[]"
},
"prev": {
"prefix": "|<"
},
"next": {
"prefix": ">|"
},
"shuffle-on": {
"prefix": "S"
},
"shuffle-off": {
"prefix": "[s]"
},
"repeat-on": {
"prefix": "R"
},
"repeat-off": {
"prefix": "[r]"
}
},
"pasink": {
"muted": { "prefix": "audio(mute)" },
"unmuted": { "prefix": "audio" }
"muted": {
"prefix": "audio(mute)"
},
"unmuted": {
"prefix": "audio"
}
},
"amixer": {
"muted": { "prefix": "audio(mute)" },
"unmuted": { "prefix": "audio" }
"muted": {
"prefix": "audio(mute)"
},
"unmuted": {
"prefix": "audio"
}
},
"pasource": {
"muted": { "prefix": "mic(mute)" },
"unmuted": { "prefix": "mic" }
"muted": {
"prefix": "mic(mute)"
},
"unmuted": {
"prefix": "mic"
}
},
"nic": {
"wireless-up": { "prefix": "wifi" },
"wireless-down": { "prefix": "wifi" },
"wired-up": { "prefix": "lan" },
"wired-down": { "prefix": "lan" },
"tunnel-up": { "prefix": "tun" },
"tunnel-down": { "prefix": "tun" }
"wireless-up": {
"prefix": "wifi"
},
"wireless-down": {
"prefix": "wifi"
},
"wired-up": {
"prefix": "lan"
},
"wired-down": {
"prefix": "lan"
},
"tunnel-up": {
"prefix": "tun"
},
"tunnel-down": {
"prefix": "tun"
}
},
"battery": {
"charged": { "suffix": "full" },
"charging": { "suffix": "chr" },
"AC": { "suffix": "ac" },
"charged": {
"suffix": "full"
},
"charging": {
"suffix": "chr"
},
"AC": {
"suffix": "ac"
},
"discharging-10": {
"prefix": "!",
"suffix": "dis"
},
"discharging-25": { "suffix": "dis" },
"discharging-50": { "suffix": "dis" },
"discharging-80": { "suffix": "dis" },
"discharging-100": { "suffix": "dis" },
"unknown-25": { "suffix": "?" },
"unknown-50": { "suffix": "?" },
"unknown-80": { "suffix": "?" },
"unknown-100": { "suffix": "?" }
"discharging-25": {
"suffix": "dis"
},
"discharging-50": {
"suffix": "dis"
},
"discharging-80": {
"suffix": "dis"
},
"discharging-100": {
"suffix": "dis"
},
"unknown-25": {
"suffix": "?"
},
"unknown-50": {
"suffix": "?"
},
"unknown-80": {
"suffix": "?"
},
"unknown-100": {
"suffix": "?"
}
},
"battery_all": {
"charged": { "suffix": "full" },
"charging": { "suffix": "chr" },
"AC": { "suffix": "ac" },
"charged": {
"suffix": "full"
},
"charging": {
"suffix": "chr"
},
"AC": {
"suffix": "ac"
},
"discharging-10": {
"prefix": "!",
"suffix": "dis"
},
"discharging-25": { "suffix": "dis" },
"discharging-50": { "suffix": "dis" },
"discharging-80": { "suffix": "dis" },
"discharging-100": { "suffix": "dis" },
"unknown-25": { "suffix": "?" },
"unknown-50": { "suffix": "?" },
"unknown-80": { "suffix": "?" },
"unknown-100": { "suffix": "?" }
"discharging-25": {
"suffix": "dis"
},
"discharging-50": {
"suffix": "dis"
},
"discharging-80": {
"suffix": "dis"
},
"discharging-100": {
"suffix": "dis"
},
"unknown-25": {
"suffix": "?"
},
"unknown-50": {
"suffix": "?"
},
"unknown-80": {
"suffix": "?"
},
"unknown-100": {
"suffix": "?"
}
},
"caffeine": {
"activated": {"prefix": "caf-on" }, "deactivated": { "prefix": "caf-off " }
"activated": {
"prefix": "caf-on"
},
"deactivated": {
"prefix": "caf-off "
}
},
"xrandr": {
"on": { "prefix": " off "}, "off": { "prefix": " on "}, "refresh": { "prefix": " refresh "}
"on": {
"prefix": " off "
},
"off": {
"prefix": " on "
},
"refresh": {
"prefix": " refresh "
}
},
"redshift": {
"day": { "prefix": "day" }, "night": { "prefix": "night" }, "transition": { "prefix": "trans" }
"day": {
"prefix": "day"
},
"night": {
"prefix": "night"
},
"transition": {
"prefix": "trans"
}
},
"docker_ps": {
"prefix": "containers"
@ -89,23 +208,41 @@
"prefix": "sensors"
},
"traffic": {
"rx": { "prefix": "down"},
"tx": { "prefix": "up"}
"rx": {
"prefix": "down"
},
"network_traffic": {
"rx": { "prefix": "down" },
"tx": { "prefix": "up" }
"tx": {
"prefix": "up"
}
},
"mpd": {
"playing": { "prefix": ">" },
"paused": { "prefix": "||" },
"stopped": { "prefix": "[]" },
"prev": { "prefix": "|<" },
"next": { "prefix": ">|" },
"shuffle-on": { "prefix": "S" },
"shuffle-off": { "prefix": "[s]" },
"repeat-on": { "prefix": "R" },
"repeat-off": { "prefix": "[r]" }
"playing": {
"prefix": ">"
},
"paused": {
"prefix": "||"
},
"stopped": {
"prefix": "[]"
},
"prev": {
"prefix": "|<"
},
"next": {
"prefix": ">|"
},
"shuffle-on": {
"prefix": "S"
},
"shuffle-off": {
"prefix": "[s]"
},
"repeat-on": {
"prefix": "R"
},
"repeat-off": {
"prefix": "[r]"
}
},
"github": {
"prefix": "github"
@ -117,21 +254,51 @@
"prefix": "uptime"
},
"zpool": {
"poolread": {"prefix": "pool read "},
"poolwrite": {"prefix": "pool write "},
"ONLINE": {"prefix": "pool"},
"FAULTED": {"prefix": "pool (!)"},
"DEGRADED": {"prefix": "pool (!)"}
"poolread": {
"prefix": "pool read "
},
"poolwrite": {
"prefix": "pool write "
},
"ONLINE": {
"prefix": "pool"
},
"FAULTED": {
"prefix": "pool (!)"
},
"DEGRADED": {
"prefix": "pool (!)"
}
},
"git": {
"main": { "prefix": "" },
"new": { "prefix": "[n]" },
"modified": { "prefix": "[m]" },
"deleted": { "prefix": "[d]" }
"main": {
"prefix": ""
},
"new": {
"prefix": "[n]"
},
"modified": {
"prefix": "[m]"
},
"deleted": {
"prefix": "[d]"
}
},
"dunst": {
"muted": { "prefix": "dunst(muted)"},
"unmuted": { "prefix": "dunst" }
"muted": {
"prefix": "dunst(muted)"
},
"unmuted": {
"prefix": "dunst"
}
},
"twmn": {
"muted": {
"prefix": "twmn"
},
"unmuted": {
"prefix": "twmn(muted)"
}
},
"system": {
"prefix": "system"

View file

@ -1,6 +1,7 @@
{
"defaults": {
"separator": "", "padding": " ",
"separator": "",
"padding": " ",
"unknown": { "prefix": "" }
},
"date": { "prefix": "" },
@ -19,19 +20,21 @@
"load": { "prefix": "" },
"layout": { "prefix": "" },
"layout-xkb": { "prefix": "" },
"notmuch_count": { "empty": {"prefix": "\uf0e0" },
"items": {"prefix": "\uf0e0" }
"notmuch_count": {
"empty": { "prefix": "\uf0e0" },
"items": { "prefix": "\uf0e0" }
},
"todo": { "empty": {"prefix": "" },
"items": {"prefix": "" },
"uptime": {"prefix": "" }
"todo": {
"empty": { "prefix": "" },
"items": { "prefix": "" },
"uptime": { "prefix": "" }
},
"zpool": {
"poolread": {"prefix": "→ "},
"poolwrite": {"prefix": "← "},
"ONLINE": {"prefix": ""},
"FAULTED": {"prefix": "!"},
"DEGRADED": {"prefix": "!"}
"poolread": { "prefix": "→ " },
"poolwrite": { "prefix": "← " },
"ONLINE": { "prefix": "" },
"FAULTED": { "prefix": "!" },
"DEGRADED": { "prefix": "!" }
},
"cmus": {
"playing": { "prefix": "" },
@ -83,7 +86,7 @@
"charged": { "prefix": "", "suffix": "" },
"AC": { "suffix": "" },
"charging": {
"prefix": [ "", "", "", "", "" ],
"prefix": ["", "", "", "", ""],
"suffix": ""
},
"discharging-10": { "prefix": "", "suffix": "" },
@ -103,7 +106,7 @@
"charged": { "prefix": "", "suffix": "" },
"AC": { "suffix": "" },
"charging": {
"prefix": [ "", "", "", "", "" ],
"prefix": ["", "", "", "", ""],
"suffix": ""
},
"discharging-10": { "prefix": "", "suffix": "" },
@ -120,11 +123,11 @@
"unknown-100": { "prefix": "", "suffix": "" }
},
"caffeine": {
"activated": {"prefix": " " },
"activated": { "prefix": " " },
"deactivated": { "prefix": " " }
},
"xrandr": {
"on": { "prefix": " "},
"on": { "prefix": " " },
"off": { "prefix": " " },
"refresh": { "prefix": "" }
},
@ -144,7 +147,7 @@
"fan": { "prefix": "" },
"cpu": { "prefix": "" }
},
"traffic":{
"traffic": {
"rx": { "prefix": "" },
"tx": { "prefix": "" }
},
@ -197,9 +200,13 @@
"deleted": { "prefix": "" }
},
"dunst": {
"muted": { "prefix": ""},
"muted": { "prefix": "" },
"unmuted": { "prefix": "" }
},
"twmn": {
"muted": { "prefix": "" },
"unmuted": { "prefix": "" }
},
"pihole": {
"enabled": { "prefix": "" },
"disabled": { "prefix": "" }

View file

@ -1,6 +1,7 @@
{
"defaults": {
"separator": "\ue0b2", "padding": "\u2800",
"separator": "\ue0b2",
"padding": "\u2800",
"unknown": { "prefix": "\uf100" }
},
"date": { "prefix": "\uf2d1" },
@ -16,16 +17,17 @@
"load": { "prefix": "\uf13d" },
"layout": { "prefix": "\uf38c" },
"layout-xkb": { "prefix": "\uf38c" },
"todo": { "empty": {"prefix": "\uf453" },
"items": {"prefix": "\uf454" },
"uptime": {"prefix": "\uf4c1" }
"todo": {
"empty": { "prefix": "\uf453" },
"items": { "prefix": "\uf454" },
"uptime": { "prefix": "\uf4c1" }
},
"zpool": {
"poolread": {"prefix": "\u26c1\uf3d6"},
"poolwrite": {"prefix": "\u26c1\uf3d5"},
"ONLINE": {"prefix": "\u26c1"},
"FAULTED": {"prefix": "\u26c1\uf3bc"},
"DEGRADED": {"prefix": "\u26c1\uf3bc"}
"poolread": { "prefix": "\u26c1\uf3d6" },
"poolwrite": { "prefix": "\u26c1\uf3d5" },
"ONLINE": { "prefix": "\u26c1" },
"FAULTED": { "prefix": "\u26c1\uf3bc" },
"DEGRADED": { "prefix": "\u26c1\uf3bc" }
},
"cmus": {
"playing": { "prefix": "\uf488" },
@ -77,7 +79,7 @@
"charged": { "prefix": "\uf113", "suffix": "\uf493" },
"AC": { "suffix": "\uf493" },
"charging": {
"prefix": [ "\uf112", "\uf115", "\uf114", "", "\uf111" ],
"prefix": ["\uf112", "\uf115", "\uf114", "", "\uf111"],
"suffix": "\uf493"
},
"discharging-10": { "prefix": "\uf112", "suffix": "\uf3bc" },
@ -97,7 +99,7 @@
"charged": { "prefix": "\uf113", "suffix": "\uf493" },
"AC": { "suffix": "\uf493" },
"charging": {
"prefix": [ "\uf112", "\uf115", "\uf114", "", "\uf111" ],
"prefix": ["\uf112", "\uf115", "\uf114", "", "\uf111"],
"suffix": "\uf493"
},
"discharging-10": { "prefix": "\uf112", "suffix": "\uf3bc" },
@ -114,18 +116,22 @@
"estimate": { "prefix": "\uf402" }
},
"caffeine": {
"activated": {"prefix": "\uf272\u3000\uf354" }, "deactivated": { "prefix": "\uf272\u3000\uf355" }
"activated": { "prefix": "\uf272\u3000\uf354" },
"deactivated": { "prefix": "\uf272\u3000\uf355" }
},
"xrandr": {
"on": { "prefix": "\uf465\u3000\uf354"}, "off": { "prefix": "\uf465\u3000\uf355" }
"on": { "prefix": "\uf465\u3000\uf354" },
"off": { "prefix": "\uf465\u3000\uf355" }
},
"redshift": {
"day": { "prefix": "\uf4b6" }, "night": { "prefix": "\uf467" }, "transition": { "prefix": "\uf475" }
"day": { "prefix": "\uf4b6" },
"night": { "prefix": "\uf467" },
"transition": { "prefix": "\uf475" }
},
"sensors": {
"prefix": "\uf3b6"
},
"traffic":{
"traffic": {
"rx": { "prefix": "\uf365" },
"tx": { "prefix": "\uf35f" }
},
@ -164,11 +170,14 @@
"prefix": "\uf454"
},
"dunst": {
"muted": { "prefix": "\uf39a"},
"muted": { "prefix": "\uf39a" },
"unmuted": { "prefix": "\uf39b" }
},
"twmn": {
"muted": { "prefix": "\uf1f6" },
"unmuted": { "prefix": "\uf0f3" }
},
"system": {
"prefix": " \uf2a9 "
}
}