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,10 +20,12 @@
"load": { "prefix": "" }, "load": { "prefix": "" },
"layout": { "prefix": "" }, "layout": { "prefix": "" },
"layout-xkb": { "prefix": "" }, "layout-xkb": { "prefix": "" },
"notmuch_count": { "empty": {"prefix": "\uf0e0" }, "notmuch_count": {
"empty": { "prefix": "\uf0e0" },
"items": { "prefix": "\uf0e0" } "items": { "prefix": "\uf0e0" }
}, },
"todo": { "empty": {"prefix": "" }, "todo": {
"empty": { "prefix": "" },
"items": { "prefix": "" }, "items": { "prefix": "" },
"uptime": { "prefix": "" } "uptime": { "prefix": "" }
}, },
@ -200,6 +203,10 @@
"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,7 +17,8 @@
"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": {
"empty": { "prefix": "\uf453" },
"items": { "prefix": "\uf454" }, "items": { "prefix": "\uf454" },
"uptime": { "prefix": "\uf4c1" } "uptime": { "prefix": "\uf4c1" }
}, },
@ -114,13 +116,17 @@
"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"
@ -167,8 +173,11 @@
"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 "
} }
} }