Skip to content

Commit

Permalink
hyprland: fix eww dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
storvik committed Jul 10, 2024
1 parent 5939b3f commit 0cdbd20
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 92 deletions.
10 changes: 7 additions & 3 deletions modules/hm-modules/desktop-hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,27 @@ in
## Files and cwd
FILE="${config.home.homeDirectory}/.cache/eww_launch.dashboard"
CFG="${config.xdg.configHome}/eww"
## uncomment this line when doing eww widget development
CFG="/home/storvik/developer/nix/nix-config/modules/hm-modules/eww"
## Run eww daemon if not running already
if [[ ! `pidof eww` ]]; then
${pkgs.eww}/bin/eww daemon
sleep 1
fi
## Open widgets
run_eww() {
${pkgs.eww}/bin/eww --config "$CFG" close storbar
${pkgs.eww}/bin/eww --config "$CFG" open-many \
leftdash sysbars network
bg profile datetime sysbars network systray
}
## Launch or close widgets accordingly
if [[ ! -f "$FILE" ]]; then
touch "$FILE"
run_eww
else
${pkgs.eww}/bin/eww --config "$CFG" close \
leftdash sysbars network
bg profile datetime sysbars network systray
${pkgs.eww}/bin/eww --config "$CFG" open storbar
rm "$FILE"
fi
'';
Expand Down Expand Up @@ -233,7 +237,7 @@ in
}
{
timeout = 900;
on-timeout = "hyprlock";
on-timeout = "${ewwCmd}/bin/launch-eww ; hyprlock";
}
{
timeout = 1200;
Expand Down
Binary file added modules/hm-modules/eww/assets/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions modules/hm-modules/eww/eww.yuck
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
;;common stuff, used in multiple eww files
(defpoll time :interval "5s"
`date +'{"hour":"%H","min":"%M"}'`)

(defpoll date :interval "180s"
`date +'%B %m %y'`)

;; include storbar, my statusbar
(include "storbar.yuck")

Expand Down
6 changes: 0 additions & 6 deletions modules/hm-modules/eww/storbar.yuck
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
;; `` are just regular quotes
(defpoll time :interval "5s"
`date +'{"hour":"%H","min":"%M"}'`)

(defpoll date :interval "180s"
`date +'%B %m %y'`)

(defpoll net :interval "100s"
:initial `N/A`
`nmcli -t -f SIGNAL,ACTIVE device wifi \
Expand Down
67 changes: 30 additions & 37 deletions modules/hm-modules/eww/stoverlay.scss
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
.leftdash-bg {
.bg {
background: rgba(47, 51, 59, 0.6);
}

.box {
background-color: #474D59;
border-radius: 10px;
padding: 10px;
margin-left: 20px;
}

.leftdash-heading {
color: #81A1C1;
font-size : 32px;
font-weight : bold;
margin-top: 30px;
.profilepic-username {
margin-top: 12px;
}

.leftdash-scales {
// background-color: #3A404C;
min-height: 180px;
// controls padding between numbers in calendar
.calendar {
padding-top: 15px;
padding-left: 4px;
padding-right: 4px;
}

.leftdash-scalebox {
background-color: #3A404C;
.datetime-clock {
font-size: 60px;
margin-left: 10px;
}

.leftdash-scale {
background-color: #3AF04C;
border-radius: 16px;
.datetime-date {
margin-left: 10px;
margin-bottom: 30px;
}

.network {
margin-left: 20px;
}


.sys_bat {
color: #bfc9db;
background-color: #0f0f17;
border-radius: 10px;
.network-icon {
font-size: 42px;
font-family: 'Iosevka Nerd Font';
}

.sysbars scale trough highlight {
Expand All @@ -43,29 +49,16 @@ scale trough {
all: unset;
background-color: #232232;
border-radius: 24px;
min-height: 130px;
min-height: 120px;
min-width: 14px;
margin : 10px 0px 0px 0px;
margin : 20px;
}

.sysbars-icon {
font-family: 'Iosevka Nerd Font';
}

.network-icon {
font-size: 42px;
font-family: 'Iosevka Nerd Font';
}

.power-bg {
background-color: #474D59;
min-width: 80px;
border-radius: 10px;
margin-right: 20px;
}

.power-icons {
padding-right: 9px;
font-size: 60px;
font-family: 'Iosevka Nerd Font';
.tray {
background-color: rgba(109, 111, 115, 0.6);
font-family: GoMono Nerd Font;
}
122 changes: 77 additions & 45 deletions modules/hm-modules/eww/stoverlay.yuck
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,105 @@
(defpoll brightness :interval "15s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}'")

(defpoll ssid :interval "15s" "nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\: -f2")
(defpoll ip :interval "15s" "ip -f inet addr show wlp60s0 | sed -En -e 's/.*inet ([0-9.]+).*/\\1/p'")
(defpoll wireless-ip :interval "15s" "ip -f inet addr show wlp60s0 | sed -En -e 's/.*inet ([0-9.]+).*/\\1/p'")

(defwidget leftdash []
(box :class "leftdash-bg" :orientation "v" :space-evenly "false"
(label :class "leftdash-heading" :text "Calendar")
(calendar :show-heading "true" :show-week-numbers "true")))

(defwindow leftdash
(defwindow bg
:monitor 0
:geometry (geometry
:x "0"
:y "0"
:width "400px"
:height "800px"
:anchor "left center")
:width "100%"
:height "100%")
:vm-ignore true
:stacking "fg"
(box :class "bg"))

(defwidget profilepic []
(box :class "box" :orientation "v" :space-evenly "false"
(image :path "assets/avatar.png" :image-height 160 :image-width 160)
(label :class "profilepic-username" :halign "center" :text "Petter S. Storvik")))

(defwindow profile
:monitor 0
:geometry (geometry
:x "460"
:y "160"
:width "160px"
:height "160px")
:stacking "fg"
(profilepic))

(defwidget datetimes []
(box :class "box" :orientation "v" :space-evenly "false"
(label :class "datetime-clock" :halign "start" :text "${time.hour}:${time.min}")
(label :class "datetime-date" :halign "start" :text "${date}")
(calendar :class "calendar" :show-heading "true" :show-week-numbers "true")))

(defwindow datetime
:monitor 0
:geometry (geometry
:x "650"
:y "160"
:width "350px"
:height "400px")
:stacking "fg"
(leftdash))
(datetimes))

(defwidget battery-icon [battery status]
(label :text {status == 'Charging' ? "󰂄" :
battery < 15 ? "󰁺" :
battery < 30 ? "󰁼" :
battery < 45 ? "󰁽" :
battery < 60 ? "󰁿" :
battery < 75 ? "󰂁" :
battery < 95 ? "󰂂" : "󰁹"}))
(defwidget network []
(box :class "box" :orientation "v" :space-evenly "true"
(box :class "network" :orientation "h" :space-evenly "false" :spacing 40 :valign "center"
(label :class "network-icon" :text "󰖩")
(box :orientation "v" :space-evenly "false" :spacing 10 :valign "center"
(label :text ssid :halign "start")
(label :text wireless-ip :halign "start")))
(box :class "network" :orientation "h" :space-evenly "false" :spacing 40 :valign "center"
(label :class "network-icon" :text "󰈀")
(box :orientation "v" :space-evenly "false" :spacing 10 :halign "center" :valign "center"
(label :text "no device connected" :halign "start")
(label :text "no ethernet ip" :halign "start")))))

(defwindow network
:monitor 0
:geometry (geometry
:x "460"
:y "592"
:width "570px"
:height "180px")
:stacking "fg"
(network))

(defwidget sysbars []
(box :orientation "h" :space-evenly "true" :spacing 60 :class "leftdash-scales" :halign "center"
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 20 :vexpand "false" :hexpand "false"
(box :class "box" :orientation "h" :space-evenly "true" :halign "center"
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 4
(scale :min 0 :max 101 :value brightness :flipped "true" :orientation "v")
(label :class "sysbars-icon" :text "󰃠"))
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 20 :vexpand "false" :hexpand "false"
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 4
(scale :min 0 :max 101 :value 20 :flipped "true" :orientation "v")
(label :class "iconcpu" :text ""))
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 20 :vexpand "false" :hexpand "false"
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 4
(scale :min 0 :max 101 :value volume :flipped "true" :orientation "v")
(label :class "iconcpu" :text ""))
(box :class "sysbars" :orientation "v" :space-evenly "false" :spacing 20 :vexpand "false" :hexpand "false"
(scale :min 0 :max 101 :value {EWW_BATTERY.BAT0.capacity} :flipped "true" :orientation "v")
(battery-icon :status {EWW_BATTERY.BAT0.status} :battery {EWW_BATTERY.BAT0.capacity}))))
(label :class "iconcpu" :text ""))))

(defwindow sysbars
:monitor 0
:geometry (geometry
:x "20"
:y "0"
:width "380px"
:height "180px"
:anchor "left center")
:x "276"
:y "380"
:width "570px"
:height "180px")
:stacking "fg"
(sysbars))

(defwidget network []
(box :orientation "h" :space-evenly "false" :spacing 40 :valign "center"
(label :class "network-icon" :text "󰖩")
(box :orientation "v" :space-evenly "false" :spacing 10 :halign "center" :valign "center"
(label :text ssid)
(label :text ip))))
(defwidget tray []
(box :class "box" :orientation "h"
(systray :spacing 4 :orientation "h" :space-evenly true :icon-size 32)))

(defwindow network
(defwindow systray
:monitor 0
:geometry (geometry
:x "110"
:y "240"
:width "380px"
:height "180px"
:anchor "left bottom")
:x "458"
:y "780"
:width "574px"
:height "60px")
:stacking "fg"
(network))
(tray))
2 changes: 1 addition & 1 deletion modules/nixos/desktop-hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ in
enable = (!cfg.disableLoginManager);
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd hyprland";
};
};
};
Expand Down

0 comments on commit 0cdbd20

Please sign in to comment.