adjustments for astal+ewwbar
parent
d680730d30
commit
84420733bb
|
|
@ -53,8 +53,49 @@ class AstalMenuApp(Gtk.Application):
|
|||
settings = Settings()
|
||||
services = Services()
|
||||
self.window = MenuWindow(self, settings, services)
|
||||
self._register_actions()
|
||||
self.hold() # stay alive with no visible window
|
||||
|
||||
def _register_actions(self) -> None:
|
||||
# Mirrors the --show/--hide/--toggle/--appdrawer verbs from do_command_line, but
|
||||
# reachable via org.gtk.Actions.Activate. menu-toggle.sh calls these directly with
|
||||
# `gdbus call` for already-running instances, which skips spawning a whole second
|
||||
# python3 + GTK process (~0.5s) just to forward one verb over D-Bus.
|
||||
def add(name: str, callback, has_side: bool) -> None:
|
||||
action = Gio.SimpleAction.new(name, GLib.VariantType.new("s") if has_side else None)
|
||||
action.connect("activate", callback)
|
||||
self.add_action(action)
|
||||
|
||||
def side_of(param: GLib.Variant | None) -> str:
|
||||
return param.get_string() if param is not None else ""
|
||||
|
||||
def on_show(_action, param) -> None:
|
||||
assert self.window is not None
|
||||
if side_of(param):
|
||||
self.window.set_side(side_of(param))
|
||||
self.window.show_menu()
|
||||
|
||||
def on_hide(_action, _param) -> None:
|
||||
assert self.window is not None
|
||||
self.window.hide_menu()
|
||||
|
||||
def on_toggle(_action, param) -> None:
|
||||
assert self.window is not None
|
||||
if side_of(param):
|
||||
self.window.set_side(side_of(param))
|
||||
self.window.toggle()
|
||||
|
||||
def on_appdrawer(_action, param) -> None:
|
||||
assert self.window is not None
|
||||
if side_of(param):
|
||||
self.window.set_side(side_of(param))
|
||||
self.window.show_menu(focus_appdrawer=True)
|
||||
|
||||
add("show", on_show, has_side=True)
|
||||
add("hide", on_hide, has_side=False)
|
||||
add("toggle", on_toggle, has_side=True)
|
||||
add("appdrawer", on_appdrawer, has_side=True)
|
||||
|
||||
def do_command_line(self, cmdline: Gio.ApplicationCommandLine) -> int:
|
||||
args = list(cmdline.get_arguments()[1:])
|
||||
# Optional "--side top|bottom|left|right": the menu slides in from and pins to
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
* {
|
||||
all: unset; // Unsets everything so you can style everything from scratch
|
||||
font-family: Agave Nerd Font Mono, sans-serif;
|
||||
font-size: 13pt;
|
||||
font-size: 20pt;
|
||||
}
|
||||
|
||||
tooltip {
|
||||
|
|
@ -72,8 +72,8 @@ tooltip {
|
|||
color: #5018dd;
|
||||
|
||||
margin: 2px 3px;
|
||||
min-width: 26px;
|
||||
min-height: 26px;
|
||||
min-width: 40px;
|
||||
min-height: 40px;
|
||||
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
:geometry (geometry :x "0%"
|
||||
:y "1%"
|
||||
:width "99%"
|
||||
:height "44px"
|
||||
:height "60px"
|
||||
:anchor "top center")
|
||||
:exclusive true
|
||||
(bar :monitor_ monitor))
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
(box :orientation "h" :space-evenly false :halign "start"
|
||||
(osk)
|
||||
(box :class "music" {"${battery}"})
|
||||
(button :onclick "~/.config/scripts/menu-toggle.sh toggle top" :class "icon-btn" :valign "center" :width 26 :height 26 {""})
|
||||
(button :onclick "~/.config/scripts/menu-toggle.sh" :class "icon-btn" :valign "center" :width 26 :height 26 {""})
|
||||
(metric :label " "
|
||||
:value volume
|
||||
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"
|
||||
|
|
|
|||
Loading…
Reference in New Issue