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

View file

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

View file

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