adapt desktop
adapt config so that it works on desktop too
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
(defwindow power []
|
||||
:class "powermenuWindow"
|
||||
:geometry (geometry
|
||||
:width "200px"
|
||||
:height "50px"
|
||||
:anchor "center center"
|
||||
:x "0%"
|
||||
:y "0%")
|
||||
(powerpopup))
|
||||
|
||||
(defwidget powerpopup []
|
||||
(box
|
||||
:class "powermenu"
|
||||
@@ -27,23 +37,3 @@
|
||||
:class "powermenu-button"
|
||||
(label
|
||||
:text ""))))
|
||||
(defwidget powermenu [shutdown shutdown_icon reboot
|
||||
reboot_icon logout logout_icon]
|
||||
(box :class "powermenu" :spacing 5
|
||||
:vexpand true :hexpand true
|
||||
:valign "end" :halign "end"
|
||||
:space-evenly false
|
||||
(button :onclick shutdown shutdown_icon)
|
||||
(button :onclick reboot reboot_icon)
|
||||
(button :onclick logout logout_icon)))
|
||||
|
||||
(defwindow power []
|
||||
:class "powermenuWindow"
|
||||
:geometry (geometry
|
||||
:width "200px"
|
||||
:height "50px"
|
||||
:anchor "center center"
|
||||
:x "0%"
|
||||
:y "0%")
|
||||
(powerpopup)
|
||||
)
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
WINDOW_NAME="power"
|
||||
|
||||
echo "Power button pressed" >>/tmp/acpi_log.txt
|
||||
WINDOW="power"
|
||||
DISPLAY=""
|
||||
|
||||
# Check if the window is already open
|
||||
if eww active-windows | grep -q "$WINDOW_NAME"; then
|
||||
eww close "$WINDOW_NAME"
|
||||
else
|
||||
eww open "$WINDOW_NAME" --screen "$(wlr-randr | grep -oP '^\S+' | head -n 1)"
|
||||
if eww active-windows | grep -q "$WINDOW"; then
|
||||
eww close "$WINDOW"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Determin screen
|
||||
if [[ "$(hostname)" == "eliasLaptop" ]]; then
|
||||
DISPLAY="eDP-1"
|
||||
elif [[ "$(hostname)" == "eliasDesktop" ]]; then
|
||||
DISPLAY="DVI-D-1"
|
||||
fi
|
||||
|
||||
echo "$DISPLAY"
|
||||
|
||||
eww open "$WINDOW" --screen "$DISPLAY"
|
||||
|
||||
Reference in New Issue
Block a user