Update eww

This commit is contained in:
2024-07-06 22:33:16 +03:00
parent 16221d5408
commit 1232ed50ac
32 changed files with 422 additions and 207 deletions
+8
View File
@@ -0,0 +1,8 @@
(deflisten window :initial "..." "./lib/get-active-window.sh")
(defwidget active-window []
(box
:halign "center"
(label :class "box" :text "${window?: 'none'}")
)
)
@@ -1,4 +1,4 @@
(defpoll volume-level :interval "1s" "sh widgets/audio/get-volume-level.sh")
(defpoll volume-level :interval "1s" "./lib/get-volume-level.sh")
(defwidget icon []
(label :text {volume-level > 66 ? "" : volume-level > 0 ? "" : ""})
@@ -13,7 +13,7 @@
:halign "end"
(eventbox :cursor "pointer" (button :class "audio-source interactive" :onclick "pactl set-default-sink 57" "󰍹"))
(eventbox :cursor "pointer" (button :class "audio-source-2 interactive" :onclick "pactl set-default-sink 64" "󰋋"))
(eventbox :cursor "pointer" :class "interactive" :onscroll "sh widgets/audio/change-volume.sh {}"
(eventbox :cursor "pointer" :class "interactive" :onscroll "./lib/change-volume.sh {}"
(box :class "volume"
(icon)
(button :onclick "pavucontrol &"
+49
View File
@@ -0,0 +1,49 @@
(include "./bar/active-window.yuck")
(include "./bar/audio.yuck")
; (include "./bar/brightness.yuck")
(include "./bar/clock.yuck")
(include "./bar/kbd-layout.yuck")
(include "./bar/media.yuck")
(include "./bar/workspaces.yuck")
(defwidget right []
(box :class "box right"
:orientation "h"
:halign "end"
:space-evenly false
(systray :hexpand true :class "systray" :icon-size 18 :spacing 4)
(kbd-layout)
(audio)
(media)
; (brightness)
(clock)
(eventbox :cursor "pointer"
(button :class "power-button interactive" :onclick "eww open --toggle power-menu" "󰐥")
)
)
)
(defwidget bar [monitor-workspaces]
(box :class "bar" :orientation "h"
(workspaces :monitor-workspaces monitor-workspaces)
(active-window)
(right)
)
)
(defwindow bar [monitor monitor-workspaces]
:monitor monitor
:geometry (geometry :x "0%"
:y "4px"
:width "99.7%"
:height "32px"
:anchor "top center"
)
:exclusive true
:windowtype "dock"
:wm-ignore false
:focusable false
(bar :monitor-workspaces monitor-workspaces)
)
@@ -3,7 +3,7 @@
(defpoll brightness-1 :interval "2s" "ddcutil -d 1 getvcp 10 | awk '{ split($9, a, \",\"); print a[1]}'")
(defwidget brightness []
(eventbox :onscroll "sh widgets/brightness/change-brightness.sh {} ${brightness-1 + 0}"
(eventbox :onscroll "./lib/change-brightness.sh {} ${brightness-1 + 0}"
(label :text "󰃞 ${substring(brightness-1, 0, 2)}")
)
)
+30
View File
@@ -0,0 +1,30 @@
(defpoll date-time :interval "5s" "./lib/date-time.sh")
(defwidget date []
(box :class "date"
"${date-time.date}"
)
)
(defwidget day []
(box :class "day"
"${date-time.day}"
)
)
(defwidget time []
(box :class "time"
"${date-time.time}"
)
)
(defwidget clock []
(box :class "clock"
:orientation "h"
:space-evenly false
:valign "center"
(date)
(day)
(time)
)
)
@@ -3,6 +3,7 @@
:orientation "h"
:space-evenly false
:halign "center"
:class "interactive"
(eventbox :cursor "pointer" :class "interactive" :onclick "hyprctl switchxkblayout usb-hid-keyboard next"
(label :text {keyboard-layout} :class "kbd-layout")
)
+65
View File
@@ -0,0 +1,65 @@
(defpoll mediastatus :interval "1s" "./lib/media-status.sh")
(defwidget media []
(eventbox :cursor "pointer" :onmiddleclick "playerctl play-pause"
(button :class "media-status interactive" :onclick "eww open --toggle media-menu"
(label :text "${mediastatus.status == "Playing" ? "" : mediastatus.status == "Paused" ? "" : ""}")
)
)
)
(defwidget media_full []
(box :orientation "v" :space-evenly false :class "media-window"
(label :class "title" :text "${mediastatus.artist} - ${mediastatus.title}" :show-truncated false)
(label :class "album" :text "${mediastatus.album}" :show-truncated false)
(box :class "media-cover" :style "background: url('${mediastatus.artUrl}'); background-size: cover;" :height 300)
(box :class "media-controls" :spacing 12 :space-evenly false :halign "center"
(eventbox :cursor "pointer"
(button :class "media-button" :class "media-button shuffle ${mediastatus.shuffle == "On" ? "active" : ""}" :onclick "playerctl shuffle toggle" "")
)
(eventbox :cursor "pointer"
(button :class "media-button" :onclick "playerctl previous" "")
)
(eventbox :cursor "pointer"
(button
:class "media-button ${mediastatus.status == "Playing" ? "pause" : "play"}"
:onclick "./lib/media-play-pause.sh"
"${mediastatus.status == "Playing" ? "" : ""}"
)
)
(eventbox :cursor "pointer"
(button :class "media-button" :onclick "playerctl next" "")
)
(eventbox :cursor "pointer"
(button
:class "media-button loop ${mediastatus.loop != "None" ? "active" : ""}"
:onclick "playerctl loop ${mediastatus.loop == "Playlist" ? "track" : mediastatus.loop == "Track" ? "none" : "playlist"}"
"${mediastatus.loop == "Track" ? "󰑘" : "󰑖"}"
)
)
)
)
)
(defwindow media-menu
:monitor 0
:namespace "media-menu"
:stacking "overlay"
:geometry (geometry :x "8px"
:y "8px"
:width "400px"
:anchor "top right"
)
:wm-ignore false
:focusable false
(box :class "control-centre"
(media_full)
)
)
+15
View File
@@ -0,0 +1,15 @@
(deflisten active-workspace :initial "." "./lib/get-active-workspace.sh")
(defwidget workspaces [?monitor-workspaces]
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 8
(for workspace in monitor-workspaces
(eventbox :cursor "pointer"
(button :class "interactive workspace ${active-workspace == workspace ? "active" : ""}" :onclick "hyprctl dispatch workspace ${workspace}" "${workspace}")
)
)
)
)
+138 -44
View File
@@ -1,47 +1,46 @@
* {
all: unset;
font-family: "SF Pro Light";
}
.bar {
font-family: "FiraCode Nerd Fonot";
border-radius: 8px;
}
$bg: rgba(0, 0, 0, 0.5);
$fg: #dedede;
$menu-border: rgba(255, 255, 255, 0.1);
$bar-gap: 8px;
.interactive, .workspace {
.interactive {
border-radius: 4px;
margin: 4px 0;
transition: background-color 0.4s ease;
&:not(.active):hover {
background-color: rgba(255, 255, 255, 0.2);
}
}
.workspace {
padding: 0 8px;
}
.workspace.current {
background-color: #fff;
color: #000;
font-weight: bold;
}
.interactive:not(.active):hover,
.workspace:not(.current):hover {
background-color: rgba(255, 255, 255, 0.3);
&.active {
background-color: $fg;
color: $bg;
font-weight: bold;
}
}
.box {
background-color: rgba(255, 255, 255, 0.2);
background-color: $bg;
border-radius: 8px;
padding-left: 8px;
padding-right: 12px;
padding: 0 calc($bar-gap * 1.5);
color: $fg;
}
.right > :not(:first-child) {
margin-left: 8px;
margin-left: $bar-gap;
}
.audio-source {
margin-top: 6px;
padding-top: 2px;
padding-left: 8px;
padding-right: 12px;
}
@@ -57,40 +56,135 @@
.kbd-layout {
padding: 0 8px;
}
.control-centre {
background-color: rgba(0, 0, 0, 0.8);
padding: 16px 32px;
border-radius: 4px;
}
.media-status {
padding-right: 8px;
padding-right: 10px;
padding-left: 8px;
}
.media-window {
.media-cover {
border-radius: 8px;
border: 2px solid #fff;
background-size: contain;
.control-centre {
background-color: $bg;
border: 3px solid $menu-border;
}
border-radius: 8px;
padding: 16px 48px;
.media-controls {
margin-top: 16px;
}
.media-window {
.title {
font-weight: bold;
font-size: 15px;
};
.media-button {
border-radius: 8px;
padding: 32px 0;
background-color: rgba(255, 255, 255, 0.4);
transition: background-color 0.4s ease;
.album {
font-size: 13px;
color: #aaa
}
&:hover {
background-color: rgba(255, 255, 255, 0.2);
.media-cover {
margin-top: 12px;
border-radius: 16px;
border: 2px solid $menu-border;
}
.media-controls {
margin-top: 16px;
}
.media-button {
padding: 8px 13px;
border-radius: 100%;
border: 2px solid $menu-border;
transition: all 0.4s ease;
&.shuffle {
padding-left: 10px;
padding-right: 16px;
&.active {
background-color: $fg;
color: $bg;
}
}
&.loop {
padding-left: 12px;
padding-right: 14px;
&.active {
background-color: $fg;
color: $bg;
}
}
&.pause {
background-color: $fg;
color: $bg;
}
&:hover {
background-color: $fg;
border-color: $fg;
color: $bg;
}
}
}
}
.power-menu {
background-color: $bg;
border: 3px solid $menu-border;
border-radius: 32px;
.power-menu-item {
font-size: 44px;
background-color: $bg;
border-radius: 20px;
border: 1px solid $menu-border;
margin: 16px 0;
margin-right: 16px;
padding-right: 4px; /* this makes sure icons from nerd font are centered */
transition: background-color 0.4s ease, color 0.4s ease;
color: $fg;
&:hover {
background-color: $fg;
color: $bg;
}
&.first {
margin-left: 16px;
}
}
}
.power-button {
padding-right: 8px;
padding-left: 8px;
margin-left: 4px;
font-size: 18px;
}
.clock {
margin-right: 8px;
.date {
border: 1px solid rgba(255, 255, 255, 0.3);
border-top: 4px solid rgba(255, 255, 255, 0.6);
padding: 0 8px;
border-radius: 4px;
margin: 6px 0;
font-size: 12px;
}
.day {
margin-left: 6px;
}
.time {
margin-left: 8px;
}
}
+18 -66
View File
@@ -1,76 +1,28 @@
(include "./widgets/active-window/active-window.yuck")
(include "./widgets/audio/audio.yuck")
; (include "./widgets/brightness/brightness.yuck")
(include "./widgets/clock/clock.yuck")
(include "./widgets/kbd-layout/kbd-layout.yuck")
(include "./widgets/media/media.yuck")
(include "./widgets/workspaces/workspaces.yuck")
(include "./power-menu/power-menu.yuck")
(include "./bar/bar.yuck")
(defwidget right []
(box :class "box right"
:orientation "h"
:space-evenly false
:halign "end"
(systray :hexpand true :class "systray" :icon-size 18 :spacing 4)
(kbd-layout)
(audio)
(media)
; (brightness)
(clock)
))
(defwindow bar
:monitor 0
:geometry (geometry :x "0%"
:y "4px"
:width "99.7%"
:height "32px"
:anchor "top center"
)
:exclusive true
:windowtype "dock"
:wm-ignore false
:focusable false
(box :class "bar" :orientation "h"
(workspaces :monitor-workspaces "[1, 2]")
(active-window)
(right)
)
)
(defwindow bar2
; a hacky solution for moving the windows on my second monitor a bit up so I can see them :D
(defwindow monitor-bump
:monitor 1
:geometry (geometry :x "0%"
:y "4px"
:width "99.7%"
:height "32px"
:anchor "top center"
)
:geometry (geometry :x "0" :y "0" :width "100%" :height "120" :anchor "bottom center")
:exclusive true
:windowtype "dock"
:wm-ignore false
:wm-ignore true
:focusable false
(box :class "bar" :orientation "h"
(workspaces :monitor-workspaces "[3, 4]")
(active-window)
(right)
)
(box " ")
)
; (defvar r_bar_systray false)
; (defvar r_bar_systray false)
; (defwidget w_bar_tray[] (revealer
; :reveal r_bar_systray
; :transition "slideleft"
; (eventbox :class "tray" :spacing 20 :space-evenly false
; (box :class "widget" :spacing 0 :space-evenly false
; (systray :icon-size 18)
; )
; )
; )
; )
; (defwidget w_bar_tray[] (revealer
; :reveal r_bar_systray
; :transition "slideleft"
; (eventbox :class "tray" :spacing 20 :space-evenly false
; (box :class "widget" :spacing 0 :space-evenly false
; (systray :icon-size 18)
; )
; )
; )
; )
@@ -9,5 +9,8 @@ DaySuffix() {
esac
}
date=$(date "+%a, %b %-d`DaySuffix` · %H:%M")
printf "%s" "$date"
day=$(date "+%a")
date=$(date "+%-d")
time=$(date "+%H:%M")
echo "{\"date\": \"$date\", \"day\": \"$day\", \"time\": \"$time\"}"
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env sh
if [[ $(playerctl status) == "Playing" ]]; then
playerctl pause
else
playerctl play
fi
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env sh
status=$(playerctl status 2>/dev/null)
artist=$(playerctl metadata --format "{{artist}}" 2>/dev/null)
title=$(playerctl metadata --format "{{title}}" 2>/dev/null)
album=$(playerctl metadata --format "{{album}}" 2>/dev/null)
artUrl=$(playerctl metadata --format "{{mpris:artUrl}}" 2>/dev/null)
length=$(playerctl metadata --format "{{duration(mpris:length)}}" 2>/dev/null)
shuffle=$(playerctl shuffle 2>/dev/null)
loop=$(playerctl loop 2>/dev/null)
echo "{
\"status\": \"$status\",
\"artist\": \"$artist\",
\"title\": \"$title\",
\"album\": \"$album\",
\"artUrl\": \"$artUrl\",
\"length\": \"$length\",
\"shuffle\": \"$shuffle\",
\"loop\": \"$loop\"
}"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
hyprlock
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
loginctl kill-user $USER
@@ -0,0 +1,26 @@
(defwindow power-menu
:namespace "power-menu"
:monitor 0
:stacking "overlay"
:geometry (geometry :x "50%"
:y "50%"
:width "30%"
:height "200px"
:anchor "center"
)
(box :class "power-menu" :orientation "h"
(eventbox :cursor "pointer"
(button :class "power-menu-item first" :onclick "./power-menu/lock.sh" "")
)
(eventbox :cursor "pointer"
(button :class "power-menu-item" :onclick "./power-menu/logout.sh" "󰈆")
)
(eventbox :cursor "pointer"
(button :class "power-menu-item" :onclick "./power-menu/reboot.sh" "")
)
(eventbox :cursor "pointer"
(button :class "power-menu-item" :onclick "./power-menu/shutdown.sh" "")
)
)
)
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
systemctl reboot
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
systemctl poweroff now
@@ -1,7 +0,0 @@
(deflisten window :initial "..." "sh ./widgets/active-window/get-active-window.sh")
(defwidget active-window []
(box
(label :class "box" :text "${window}")
)
)
-10
View File
@@ -1,10 +0,0 @@
(defwidget clock []
(box :class "clock"
:orientation "h"
:space-evenly false
:halign "center"
date-time)
)
(defpoll date-time :interval "1s"
"sh widgets/clock/date-time.sh")
-50
View File
@@ -1,50 +0,0 @@
(defpoll media-status :interval "1s" "playerctl status")
(defpoll media-artist :interval "1s" "playerctl metadata --format \"{{artist}}\"")
(defpoll media-title :interval "1s" "playerctl metadata --format \"{{title}}\"")
(defpoll media-album :interval "1s" "playerctl metadata --format \"{{album}}\"")
(defpoll media-artUrl :interval "1s" "playerctl metadata --format \"{{mpris:artUrl}}\"")
(defpoll media-length :interval "1s" "playerctl metadata --format \"{{duration(mpris:length)}}\"")
(defwidget media []
(box
(eventbox :cursor "pointer" :onclick "eww open --toggle window_media" :class "interactive" :onmiddleclick "playerctl play-pause"
(box :class "media-status"
(label :text "${media-status == "Playing" ? "" : media-status == "Paused" ? "" : ""}")
)
)
)
)
(defwidget media_full []
(box :orientation "v" :space-evenly false :class "media-window"
(label :text media-artist :show-truncated false)
(label :text media-title :show-truncated false)
(label :text media-album :show-truncated false)
(box :class "media-cover" :style "background: url('${media-artUrl}')" :width 180 :height 140)
(box :class "media-controls" :spacing 16
(eventbox :cursor "pointer" :onclick "playerctl previous" :class "media-button" "")
(eventbox :cursor "pointer" :class "media-button play" :onclick "playerctl play" "")
(eventbox :cursor "pointer" :class "media-button pause" :onclick "playerctl pause" "")
(eventbox :cursor "pointer" :class "media-button next" :onclick "playerctl next" "")
)
)
)
(defwindow window_media
:monitor 0
:geometry (geometry :x "8px"
:y "8px"
:width "300px"
:anchor "top right"
)
:wm-ignore false
:focusable false
(box :class "control-centre bar"
(media_full)
)
)
@@ -1,13 +0,0 @@
(deflisten active-workspace :initial "." "sh widgets/workspaces/get-active-workspace.sh")
(defwidget workspaces [?monitor-workspaces]
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 10
(for workspace in monitor-workspaces
(button :class "workspace ${active-workspace == workspace ? "current" : ""}" :onclick "hyprctl dispatch workspace ${workspace}" "${workspace}")
)
)
)
+7 -3
View File
@@ -15,11 +15,17 @@ bind = $mainMod, M, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating,
bind = $mainMod, L, exec, hyprlock
bind = $mainMod, N, exec, swaync-client --toggle-panel
bind = alt, space, exec, $menu --class=floatingTerm
bind = alt win shift, e, exec, $emojiMenu
# bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# eww
bind = $mainMod, F2, exec, eww open --toggle monitor-bump
bind = ctrl alt, Q, exec, eww open --toggle power-menu
bind = ctrl shift win, M, exec, eww open --toggle media-menu
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
@@ -90,7 +96,5 @@ bindm = $mainMod, mouse:273, resizewindow
# game mode
bind = $mainMod, F1, exec, ~/.config/hypr/game-mode.sh
# eww
bind = ctrl SHIFT win, M, exec, eww open --toggle window_media
bind = ctrl SHIFT win, W, exec, /home/georgi/Scripts/wallpaper
bind = ctrl shift win, W, exec, /home/georgi/Scripts/wallpaper
+9 -2
View File
@@ -22,8 +22,8 @@ $emojiMenu = rofi -modi emoji -show emoji
# exec-once = $terminal
# exec-once = nm-applet &
# exec-once = waybar & hyprpaper & firefox
exec-once = eww open bar &
exec-once = eww open bar2 &
exec-once = eww open bar --id bar1 --arg monitor=0 --arg monitor-workspaces="[1,2]"
exec-once = eww open bar --id bar2 --arg monitor=1 --arg monitor-workspaces="[3,4]"
exec-once = swww-daemon --format xrgb &
exec-once = swaync &
@@ -53,3 +53,10 @@ windowrulev2 = float,class:(steam),title:(Steam Settings)
source = ~/.config/hypr/input.conf
source = ~/.config/hypr/binds.conf
# blur eww power-menu
layerrule = blur, power-menu
layerrule = ignorezero, power-menu
layerrule = blur, media-menu
layerrule = ignorezero, media-menu
+7 -7
View File
@@ -1,10 +1,10 @@
# https://wiki.hyprland.org/Configuring/Variables/#general
general {
gaps_in = 3
gaps_out = 6
gaps_in = 4
gaps_out = 4
border_size = 3
border_size = 2
col.active_border = rgba(ca9ee6ff) rgba(f2d5cfff) 45deg
col.inactive_border = rgba(b4befecc) rgba(6c7086cc) 45deg
@@ -18,16 +18,16 @@ general {
# https://wiki.hyprland.org/Configuring/Variables/#decoration
decoration {
rounding = 5
rounding = 10
# Change transparency of focused and unfocused windows
active_opacity = 1.0
inactive_opacity = 1.0
drop_shadow = false
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
# shadow_range = 4
# shadow_render_power = 3
# col.shadow = rgba(1a1a1aee)
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur {