This commit is contained in:
jay 2026-04-06 01:21:30 +08:00
parent 35abfa07bc
commit 36a51d8127
7 changed files with 93 additions and 15 deletions

View File

@ -13,3 +13,4 @@ QT_QPA_PLATFORM=wayland;xcb
CLUTTER_BACKEND=wayland
SDL_VIDEODRIVER=wayland
EDITOR=nvim
ELECTRON_OZONE_PLATFORM_HINT=auto

View File

@ -55,13 +55,18 @@ button {
border-radius: 6px;
}
.volume-widget, .brightness-widget {
padding: 0 5px;
.battery-widget, .volume-widget, .brightness-widget, .caffeine {
padding: 0 2px;
}
.volume-widget button:hover, .brightness-widget button:hover {
background-color: $surface;
.tray-button {
padding: 0 8px;
border-radius: 6px;
transition: background-color 0.2s;
}
.tray-button:hover {
background-color: $surface;
}
.popup-box {
@ -117,3 +122,37 @@ button {
calendar {
padding: 5px;
}
.popup-title {
font-size: 16px;
font-weight: bold;
color: $blue;
margin-bottom: 5px;
}
.popup-subtitle {
font-size: 12px;
color: $fg;
opacity: 0.8;
margin-top: 5px;
}
.profile-active {
background-color: $blue;
color: $crust;
padding: 8px 12px;
border-radius: 6px;
font-weight: bold;
}
.profile-inactive {
background-color: $surface;
color: $fg;
padding: 8px 12px;
border-radius: 6px;
}
.profile-inactive:hover {
background-color: lighten($surface, 5%);
border: 1px solid $blue;
}

View File

@ -4,6 +4,10 @@
(defpoll vol_icon :interval "1s" :initial "🔉" "bash ~/.config/eww/scripts/volume.sh icon")
(defpoll br :interval "1s" :initial "50" "bash ~/.config/eww/scripts/brightness.sh get")
(defpoll br_icon :interval "1s" :initial "☀️" "bash ~/.config/eww/scripts/brightness.sh icon")
(defpoll battery :interval "10s" :initial "100" "cat /sys/class/power_supply/BAT*/capacity 2>/dev/null || echo 100")
(defpoll battery_status :interval "10s" :initial "Unknown" "cat /sys/class/power_supply/BAT*/status 2>/dev/null || echo Unknown")
(defpoll power_profile :interval "5s" :initial "balanced" "bash ~/.config/eww/scripts/power-profile.sh get")
(defpoll power_profile_icon :interval "5s" :initial "⚖️" "bash ~/.config/eww/scripts/power-profile.sh icon")
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces.sh")
@ -23,21 +27,35 @@
(box :class "volume-widget"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh volume_popup"
:onrightclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
:class "tray-button"
"${vol_icon} ${vol}%")))
(defwidget brightness_widget []
(box :class "brightness-widget"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh brightness_popup"
:class "tray-button"
"${br_icon} ${br}%")))
(defwidget caffeine_widget []
(box :class "caffeine"
(button :onclick "bash ~/.config/eww/scripts/toggle-inhibit.sh"
:class {inhibit_status == "on" ? "caffeine-on" : "caffeine-off"}
:class "tray-button ${inhibit_status == 'on' ? 'caffeine-on' : 'caffeine-off'}"
{inhibit_status == "on" ? "☕" : "🌙"})))
(defwidget battery_widget []
(box :class "battery-widget"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
:tooltip "Battery: ${battery}% (${battery_status})\nPower Profile: ${power_profile}"
:class "tray-button"
"${battery_status == 'Charging' ? '🔌' :
battery >= 80 ? '🔋' :
battery >= 50 ? '🔋' :
battery >= 20 ? '🪫' :
'🪫'} ${battery}% ${power_profile_icon}")))
(defwidget tray_widget []
(box :halign "end" :class "tray-container" :space-evenly false :spacing 10
(battery_widget)
(brightness_widget)
(volume_widget)
(caffeine_widget)
@ -85,3 +103,22 @@
(label :text br_icon)
(scale :class "br-bar" :min 0 :max 101 :value {br == "" ? 0 : br} :width 150 :onchange "brightnessctl s {}%")
(label :text "${br}%")))
(defwindow power_profile_popup
:monitor "eDP-1"
:geometry (geometry :x "15px" :y "15px" :width "300px" :height "180px" :anchor "top right")
:stacking "fg"
:focusable false
(box :class "popup-box" :orientation "v" :space-evenly false :spacing 10
(label :class "popup-title" :text "Power Profile")
(box :orientation "v" :spacing 8
(button :class {power_profile == "power-saver" ? "profile-active" : "profile-inactive"}
:onclick "bash ~/.config/eww/scripts/power-profile.sh set power-saver && bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
"🐢 Power Saver")
(button :class {power_profile == "balanced" ? "profile-active" : "profile-inactive"}
:onclick "bash ~/.config/eww/scripts/power-profile.sh set balanced && bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
"⚖️ Balanced")
(button :class {power_profile == "performance" ? "profile-active" : "profile-inactive"}
:onclick "bash ~/.config/eww/scripts/power-profile.sh set performance && bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
"🚀 Performance"))
(label :class "popup-subtitle" :text "Current: ${power_profile}")))

View File

@ -5,7 +5,6 @@
#
bindsym $alt+Shift+c exec ~/bin/screenshot
bindsym $alt+Shift+m exec ~/bin/screenshot-monitor
bindsym $alt+Shift+v exec ~/bin/auto-screenshot-monitor
# Start a terminal
bindsym $mod+Return exec $term
@ -20,6 +19,8 @@
bindsym $alt+space exec $menu
bindsym $mod+Shift+w exec $window_switcher
bindsym $mod+w exec $window_workspace_switcher
bindsym $mod+Shift+v exec ~/.config/wofi/wofi-control-panel.sh
bindsym $mod+Shift+t exec ~/.config/wofi/wofi-totp-menu.sh
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
@ -167,4 +168,4 @@ bindsym $mod+r mode "resize"
#bindsym --release $mod+Shift+w exec "echo 0 > /tmp/sovpipe"
# show bindsym help
bindsym $mod+Ctrl+h exec cat ~/.config/sway/config |grep bindsym |grep -v "#"| sed 's/^[[:space:]]*//'| wofi --dmenu
bindsym $mod+Ctrl+h exec cat ~/.config/sway/conf.d/keybinding.conf |grep bindsym |grep -v "#"| sed 's/^[[:space:]]*//'| wofi --dmenu

View File

@ -4,10 +4,10 @@ output eDP-1 scale 1.3
workspace 1 output eDP-1
workspace 2 output eDP-1
workspace 3 output eDP-1
workspace 4 output HDMI-A-1 DP-9 eDP-1
workspace 5 output HDMI-A-1 DP-9 eDP-1
workspace 6 output HDMI-A-1 DP-9 eDP-1
workspace 7 output HDMI-A-1 DP-9 eDP-1
workspace 8 output HDMI-A-1 DP-9 eDP-1
workspace 4 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 5 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 6 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 7 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 8 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 9 output eDP-1
workspace 10 output eDP-1

View File

@ -54,7 +54,7 @@ exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DE
exec_always kanshi
exec dex -a -e sway -s /etc/xdg/autostart/:~/.config/autostart/
exec mako
exec udiskie --smart-tray
exec udiskie -t
exec_always ~/.config/eww/open-main.sh

View File

@ -4,7 +4,7 @@ entries=$(swaymsg -t get_tree | jq -r -c '
recurse(.nodes[]?) |
recurse(.floating_nodes[]?) |
select(.type=="con"), select(.type=="floating_con") |
(.id | tostring) + " " + .app_id + ": " + .name')
(.id | tostring) + " " + (.window_properties.class // .app_id) + ": " + .name')
echo "$entries"