feat: migrate osk-toggle to eww widget

This commit is contained in:
matt1432 2023-07-15 00:46:04 -04:00
parent 2b1ab1608d
commit b480353548
5 changed files with 84 additions and 12 deletions

View file

@ -1,6 +1,13 @@
.osk-toggle {
font-size: 30px;
min-height: 26px;
min-width: 50px;
padding: 0px 0px 0px 5px;
}
.notif-panel { .notif-panel {
min-width: 50px; min-width: 50px;
min-height: 16px; min-height: 26px;
font-size: 20px; font-size: 20px;
padding: 2px 25px 2px 35px; padding: 2px 25px 2px 35px;
} }
@ -15,7 +22,7 @@
transition: border-color 0.5s ease-in-out; transition: border-color 0.5s ease-in-out;
color: #CBA6F7; color: #CBA6F7;
border-radius: 80px; border-radius: 80px;
border: 3px solid $contrastbg; border: 2px solid #1b1b2b;
} }
.toggle-off:hover { .toggle-off:hover {
@ -28,7 +35,7 @@
transition: border-color 0.5s ease-in-out; transition: border-color 0.5s ease-in-out;
color: #CBA6F7; color: #CBA6F7;
border-radius: 80px; border-radius: 80px;
border: 3px solid #CBA6F7; border: 2px solid $contrastbg;
} }
.toggle-on:hover { .toggle-on:hover {

View file

@ -1,3 +1,32 @@
(defvar osk-toggle-state false)
(defwidget osk-toggle []
(eventbox :class {osk-toggle-state ? "toggle-on" : "toggle-off"}
:onclick "$HYPR_PATH/osk-toggle.sh toggle &"
(box :class "osk-toggle"
:space-evenly true
:spacing 6
:orientation "h"
(label :text " 󰌌 ")
)
)
)
(defwindow osk-toggle
:monitor 0
:stacking "overlay"
:exclusive "ignore"
:geometry (geometry :x "10px"
:y "9px"
:width "0px"
:height "0px"
:anchor "top left"
)
(osk-toggle)
)
(defvar toggle-state false) (defvar toggle-state false)
(defwidget tablet-toggle [] (defwidget tablet-toggle []
@ -17,7 +46,7 @@
:monitor 0 :monitor 0
:stacking "overlay" :stacking "overlay"
:exclusive "ignore" :exclusive "ignore"
:geometry (geometry :x "66px" :geometry (geometry :x "72px"
:y "9px" :y "9px"
:width "0px" :width "0px"
:height "0px" :height "0px"
@ -26,6 +55,8 @@
(tablet-toggle) (tablet-toggle)
) )
(defvar notif-panel-state false) (defvar notif-panel-state false)
(defwidget notif-panel [] (defwidget notif-panel []
@ -46,7 +77,7 @@
:stacking "overlay" :stacking "overlay"
:exclusive "ignore" :exclusive "ignore"
:geometry (geometry :x "50px" :geometry (geometry :x "50px"
:y "10px" :y "11px"
:width "0px" :width "0px"
:height "0px" :height "0px"
:anchor "top right" :anchor "top right"

View file

@ -26,6 +26,9 @@ exec-once = bash -c "sleep 7; GalaxyBudsClient /StartMinimized"
exec-once = eww daemon exec-once = eww daemon
exec-once = eww open tablet-toggle exec-once = eww open tablet-toggle
exec-once = eww open notif-panel exec-once = eww open notif-panel
exec-once = eww open osk-toggle
# TODO: put this in eww configs?
exec-once = $HYPR_PATH/osk-toggle.sh getState
# sometimes waybar starts after and stops me from pressing eww buttons # sometimes waybar starts after and stops me from pressing eww buttons
exec-once = bash -c "sleep 0.5; eww reload" exec-once = bash -c "sleep 0.5; eww reload"
@ -158,6 +161,8 @@ windowrule = float,^(com.nextcloud.desktopclient.nextcloud)$
windowrule = move cursor 0 25,^(com.nextcloud.desktopclient.nextcloud)$ windowrule = move cursor 0 25,^(com.nextcloud.desktopclient.nextcloud)$
windowrule = size 400 581,^(com.nextcloud.desktopclient.nextcloud)$ windowrule = size 400 581,^(com.nextcloud.desktopclient.nextcloud)$
windowrule = tile,^(photoshop.exe)$
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER $mainMod = SUPER
@ -217,6 +222,7 @@ bindm = $mainMod, mouse:273, resizewindow
# Take a screenshot # Take a screenshot
bind =, Print, exec, bash -c 'grim -g "$(slurp)" - | swappy -f -' bind =, Print, exec, bash -c 'grim -g "$(slurp)" - | swappy -f -'
bind = $mainMod SHIFT, C, exec, wl-color-picker
# Volume control # Volume control
binde =, XF86AudioRaiseVolume, exec, swayosd --output-volume raise binde =, XF86AudioRaiseVolume, exec, swayosd --output-volume raise

View file

@ -1,10 +1,35 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]] state () {
then if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then
echo "Running" echo "Running"
eww update osk-toggle-state=true
else
echo "Stopped"
eww update osk-toggle-state=false
fi
}
toggle () {
if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then
echo "Running"
eww update osk-toggle-state=false
busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
else else
echo "Stopped" echo "Stopped"
eww update osk-toggle-state=true
busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
fi fi
}
if [[ $1 == "getState" ]]; then
while true; do
sleep 0.2
state
done
fi
if [[ $1 == "toggle" ]];then
toggle
fi

View file

@ -26,6 +26,7 @@
(with python311Packages; [ (with python311Packages; [
python python
pyclip pyclip
gdown
]) ++ ]) ++
(with plasma5Packages; [ (with plasma5Packages; [
@ -74,6 +75,8 @@
dracula-theme dracula-theme
dracula-icon-theme dracula-icon-theme
steam-run steam-run
wineWowPackages.stable
cabextract
qt5.qtwayland qt5.qtwayland
qt6.qtwayland qt6.qtwayland
bottles-unwrapped bottles-unwrapped