home/natto/eww: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
		
							
								
								
									
										271
									
								
								home/natto/eww/bar/bar.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										271
									
								
								home/natto/eww/bar/bar.scss
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,271 @@
 | 
			
		||||
$rosewater: #F5E0DC;
 | 
			
		||||
$flamingo: #F2CDCD;
 | 
			
		||||
$pink: #F5C2E7;
 | 
			
		||||
$mauve: #CBA6F7;
 | 
			
		||||
$red: #F38BA8;
 | 
			
		||||
$maroon: #EBA0AC;
 | 
			
		||||
$peach: #FAB387;
 | 
			
		||||
$yellow: #F9E2AF;
 | 
			
		||||
$green: #A6E3A1;
 | 
			
		||||
$teal: #94E2D5;
 | 
			
		||||
$sky: #89DCEB;
 | 
			
		||||
$sapphire: #74C7EC;
 | 
			
		||||
$blue: #89B4FA;
 | 
			
		||||
$lavender: #B4BEFE;
 | 
			
		||||
$text: #CDD6F4;
 | 
			
		||||
$subtext1: #BAC2DE;
 | 
			
		||||
$subtext0: #A6ADC8;
 | 
			
		||||
$overlay2: #9399B2;
 | 
			
		||||
$overlay1: #7F849C;
 | 
			
		||||
$overlay0: #6C7086;
 | 
			
		||||
$surface2: #585B70;
 | 
			
		||||
$surface1: #45475A;
 | 
			
		||||
$surface0: #313244;
 | 
			
		||||
$base: #1E1E2E;
 | 
			
		||||
$mantle: #181825;
 | 
			
		||||
$crust: #11111B;
 | 
			
		||||
 | 
			
		||||
$background: $base;
 | 
			
		||||
$foreground: $text;
 | 
			
		||||
 | 
			
		||||
* {
 | 
			
		||||
    all: unset;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
tooltip {
 | 
			
		||||
  background: $background;
 | 
			
		||||
  border: 1px solid $pink;
 | 
			
		||||
  border-radius: 2px;
 | 
			
		||||
 | 
			
		||||
  label {
 | 
			
		||||
      padding: 5px;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@mixin color-shadow($color, $opacity: 0.08, $on-hover: 1) {
 | 
			
		||||
    color: $color;
 | 
			
		||||
 | 
			
		||||
    @if $on-hover == 0 {
 | 
			
		||||
        box-shadow: 0 0 0 9999px rgba($color, $opacity) inset;
 | 
			
		||||
    } @else {
 | 
			
		||||
        &:hover {
 | 
			
		||||
            box-shadow: 0 0 0 9999px rgba($color, $opacity) inset;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.bar, .music-large {
 | 
			
		||||
    font-family: "Fira Mono";
 | 
			
		||||
    background: $background;
 | 
			
		||||
    
 | 
			
		||||
    button:hover {
 | 
			
		||||
        transition: 0.15s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    scale trough, circular-progress {
 | 
			
		||||
        background: $surface1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.workspaces { 
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    font-family: "Lohit Devanagari";
 | 
			
		||||
 | 
			
		||||
    button {
 | 
			
		||||
        background: none;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .workspace-active {
 | 
			
		||||
        @include color-shadow($mauve, $on-hover: 0);
 | 
			
		||||
        font-size: 20px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .workspace-inactive {
 | 
			
		||||
        @include color-shadow($flamingo);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.music {
 | 
			
		||||
    button {
 | 
			
		||||
        background: none;
 | 
			
		||||
        padding: 0 10px;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .music-control {
 | 
			
		||||
        @include color-shadow($mauve);
 | 
			
		||||
        font-family: "Font Awesome 6 Free";
 | 
			
		||||
        font-size: 18px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .music-title {
 | 
			
		||||
        @include color-shadow($sapphire);
 | 
			
		||||
        font-size: 16px;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.music-large {
 | 
			
		||||
    border: solid 3px $sapphire;
 | 
			
		||||
    color: $mauve;
 | 
			
		||||
    border-radius: 5px;
 | 
			
		||||
    
 | 
			
		||||
    .music-large-cover {
 | 
			
		||||
        background-size: cover;
 | 
			
		||||
        background-position: center;
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        margin:  15px 0 15px 15px;
 | 
			
		||||
        min-height: 200px;
 | 
			
		||||
        min-width: 200px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .music-large-controls {
 | 
			
		||||
        margin: 15px;
 | 
			
		||||
        
 | 
			
		||||
        scale trough {
 | 
			
		||||
            min-height: 5px;
 | 
			
		||||
            margin: 0 15px;
 | 
			
		||||
            
 | 
			
		||||
            highlight {
 | 
			
		||||
                background-image: linear-gradient(to right, $sapphire, $teal);
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            slider {
 | 
			
		||||
                border-radius: 4px;
 | 
			
		||||
                background: $background;
 | 
			
		||||
                border: 2px $mauve solid;
 | 
			
		||||
                margin: -10px -10px;
 | 
			
		||||
                transition: 0.2s;
 | 
			
		||||
 | 
			
		||||
                &:hover {
 | 
			
		||||
                    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1); 
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                &:active {
 | 
			
		||||
                    box-shadow: 0 0 0 1px inset, 0 0 0 8px rgba(255, 255, 255, 0.1); 
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        .music-large-artist {
 | 
			
		||||
            font-size: 18px;
 | 
			
		||||
            color: $mauve;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .music-large-album {
 | 
			
		||||
            font-size: 16px;
 | 
			
		||||
            color: $sapphire;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.system {
 | 
			
		||||
    button {
 | 
			
		||||
        background: none;
 | 
			
		||||
        font-size: 20px;
 | 
			
		||||
        padding: 0 10px;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .system-scale {
 | 
			
		||||
        min-width: 100px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    scale trough {
 | 
			
		||||
        min-height: 20px;
 | 
			
		||||
        min-width: 120px;
 | 
			
		||||
        border-radius: 3px;
 | 
			
		||||
        
 | 
			
		||||
        highlight {
 | 
			
		||||
            all: unset;
 | 
			
		||||
            border-radius: 3px;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        slider {
 | 
			
		||||
            all:unset;
 | 
			
		||||
            border: none;
 | 
			
		||||
            min-width: 0;
 | 
			
		||||
            min-height: 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-sound {
 | 
			
		||||
        button {
 | 
			
		||||
            @include color-shadow($green);
 | 
			
		||||
            padding-right: 5px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        scale trough highlight {
 | 
			
		||||
            background-color: $green;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-bright {
 | 
			
		||||
        button {
 | 
			
		||||
            @include color-shadow($yellow);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        scale trough highlight {
 | 
			
		||||
            background-color: $yellow;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-temp {
 | 
			
		||||
        button {
 | 
			
		||||
            @include color-shadow($red);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .system-net {
 | 
			
		||||
        button {
 | 
			
		||||
            @include color-shadow($mauve);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-separator {
 | 
			
		||||
        min-width: 5px;
 | 
			
		||||
        background-color: $sapphire;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-metrics {
 | 
			
		||||
        transition: 0.2s;
 | 
			
		||||
 | 
			
		||||
        label {
 | 
			
		||||
            padding: 0 5px;
 | 
			
		||||
            font-size: 20px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        circular-progress {
 | 
			
		||||
            margin: 0 5px;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        .system-metric-cpu {
 | 
			
		||||
            color: $teal;
 | 
			
		||||
        }
 | 
			
		||||
    
 | 
			
		||||
        .system-metric-battery {
 | 
			
		||||
            color: $yellow;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        .system-metric-memory {
 | 
			
		||||
            color: $pink;
 | 
			
		||||
        }
 | 
			
		||||
    
 | 
			
		||||
        .system-metric-disk {
 | 
			
		||||
            color: $blue;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.system-time {
 | 
			
		||||
    label {
 | 
			
		||||
        color: $foreground;
 | 
			
		||||
        padding: 0 5px;
 | 
			
		||||
        font-weight: bold;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-time-time {
 | 
			
		||||
        font-size: 18px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .system-time-date {
 | 
			
		||||
        font-size: 20px;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								home/natto/eww/bar/bar.yuck
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								home/natto/eww/bar/bar.yuck
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
(include "bar/music.yuck")
 | 
			
		||||
(include "bar/workspaces.yuck")
 | 
			
		||||
(include "bar/system.yuck")
 | 
			
		||||
 | 
			
		||||
(defwidget bar []
 | 
			
		||||
           (box :class "bar" :orientation "h" :spacing 40
 | 
			
		||||
                (workspaces)
 | 
			
		||||
                (music_compact)
 | 
			
		||||
                (system)))
 | 
			
		||||
 | 
			
		||||
(defwindow bar
 | 
			
		||||
           :monitor 0
 | 
			
		||||
           :geometry (geometry :x "0%"
 | 
			
		||||
                               :y "0%"
 | 
			
		||||
                               :width "100%"
 | 
			
		||||
                               :height "40px"
 | 
			
		||||
                               :anchor "top center")
 | 
			
		||||
           :stacking "fg"
 | 
			
		||||
           :exclusive true
 | 
			
		||||
           (bar))
 | 
			
		||||
							
								
								
									
										13
									
								
								home/natto/eww/bar/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								home/natto/eww/bar/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
pkgs: with pkgs; [
 | 
			
		||||
  coreutils
 | 
			
		||||
  bash
 | 
			
		||||
  jq
 | 
			
		||||
  less
 | 
			
		||||
  gawk
 | 
			
		||||
  socat
 | 
			
		||||
  playerctl
 | 
			
		||||
  networkmanager
 | 
			
		||||
  light
 | 
			
		||||
  iwgtk
 | 
			
		||||
  wireplumber
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										34
									
								
								home/natto/eww/bar/hyprworkspaces
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								home/natto/eww/bar/hyprworkspaces
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
# workspace script to work with hyprland #
 | 
			
		||||
##########################################
 | 
			
		||||
 | 
			
		||||
# i dont really have multiple monitors rn
 | 
			
		||||
 | 
			
		||||
# active workspace
 | 
			
		||||
current=1
 | 
			
		||||
list_workspaces() {
 | 
			
		||||
    workspace_list=$(hyprctl -j workspaces | jq -rc '[.[]|.id]|sort')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
workspaces() {
 | 
			
		||||
  echo '{"current": '"${current}"',"list": '"${workspace_list}"'}'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
list_workspaces
 | 
			
		||||
workspaces
 | 
			
		||||
hyprctl dispatch workspace $current
 | 
			
		||||
 | 
			
		||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do
 | 
			
		||||
  case ${event%>>*} in
 | 
			
		||||
    "workspace")
 | 
			
		||||
      current=${event##*>>}
 | 
			
		||||
      workspaces
 | 
			
		||||
      ;;
 | 
			
		||||
    "createworkspace"|"destroyworkspace")
 | 
			
		||||
      list_workspaces
 | 
			
		||||
      workspaces
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										92
									
								
								home/natto/eww/bar/music.yuck
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								home/natto/eww/bar/music.yuck
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,92 @@
 | 
			
		||||
(defvar playerctl "playerctl -p 'playerctld,%any'")
 | 
			
		||||
 | 
			
		||||
; https://github.com/elkowar/eww/issues/518
 | 
			
		||||
(deflisten music :initial ""
 | 
			
		||||
           "playerctl -p 'playerctld,%any' --follow metadata --format '{\"artist\":\"{{artist}}\",\"album\":\"{{album}}\",\"title\":\"{{trunc(title,40)}}\",\"full_title\":\"{{title}}\",\"cover\":\"{{mpris:artUrl}}\", \"status\":\"{{lc(status)}}\",\"duration\":\"{{duration(mpris:length)}}\",\"raw_duration\":\"{{mpris:length}}\",\"position\":\"{{duration(position)}}\",\"raw_position\":\"{{position}}\"}'")
 | 
			
		||||
 | 
			
		||||
(defwidget music_controls[]
 | 
			
		||||
           (box
 | 
			
		||||
            (button :class "music-control" :onclick "${playerctl} previous" "")
 | 
			
		||||
            (button :class "music-control" :onclick "${playerctl} play-pause" {music.status == "playing" ? "" : "" })
 | 
			
		||||
            (button :class "music-control" :onclick "${playerctl} next" "")))
 | 
			
		||||
 | 
			
		||||
(defwidget music_large []
 | 
			
		||||
           (box
 | 
			
		||||
            :halign "center"
 | 
			
		||||
            :class "music-large"
 | 
			
		||||
            :orientation "h"
 | 
			
		||||
            (box
 | 
			
		||||
            :class "music-large-cover"
 | 
			
		||||
            :visible {music.cover != ""}
 | 
			
		||||
            :style "background-image: url(\"${music.cover}\");")
 | 
			
		||||
            (box
 | 
			
		||||
             :orientation "v"
 | 
			
		||||
             :class "music-large-controls"
 | 
			
		||||
             :spacing {music.cover == "" ? 10 : 0}
 | 
			
		||||
             (label
 | 
			
		||||
              :visible {music.artist != ""}
 | 
			
		||||
              :class "music-large-artist"
 | 
			
		||||
              :text {music.artist})
 | 
			
		||||
             (label
 | 
			
		||||
              :visible {music.album != ""}
 | 
			
		||||
              :class "music-large-album"
 | 
			
		||||
              :text {music.album})
 | 
			
		||||
             (eventbox
 | 
			
		||||
              :cursor "pointer"
 | 
			
		||||
              (music_controls))
 | 
			
		||||
             (box
 | 
			
		||||
              (label
 | 
			
		||||
               :visible {music.position != ""}
 | 
			
		||||
               :xalign {music.duration == "" ? 0.5 : 0}
 | 
			
		||||
               :style {music.duration == "" ? "font-size: 18px;": ""}
 | 
			
		||||
               :text {music.position})              
 | 
			
		||||
              (label
 | 
			
		||||
               :visible {music.duration != ""}
 | 
			
		||||
               :xalign {music.position == "" ? 0.5 : 1}
 | 
			
		||||
               :style {music.position == "" ? "font-size: 18px;": ""}
 | 
			
		||||
               :text {music.duration}))
 | 
			
		||||
             (eventbox
 | 
			
		||||
              :class "music-large-scale"
 | 
			
		||||
              :cursor "pointer"
 | 
			
		||||
              :visible {music.raw_duration != "" && music.raw_position != "" }
 | 
			
		||||
              (scale
 | 
			
		||||
               :min 0
 | 
			
		||||
               :max {music.raw_duration / 1000000}
 | 
			
		||||
               :onchange "${playerctl} position {}"
 | 
			
		||||
               :value {music.raw_position / 1000000})))))
 | 
			
		||||
 | 
			
		||||
(defvar music_control false)
 | 
			
		||||
 | 
			
		||||
(defwidget music_compact []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
            :onhover "${EWW_CMD} update music_control=true"
 | 
			
		||||
            :onhoverlost "${EWW_CMD} update music_control=false"
 | 
			
		||||
            :visible {music.title != "" && music.status != "stopped" && music != ""}
 | 
			
		||||
            :halign "center"
 | 
			
		||||
            (box
 | 
			
		||||
             :class "music"
 | 
			
		||||
             :space-evenly "false"
 | 
			
		||||
             (button
 | 
			
		||||
              :class "music-title"
 | 
			
		||||
              :onclick "${EWW_CMD} open --toggle music"
 | 
			
		||||
              :tooltip "${music.title} by ${music.artist}"
 | 
			
		||||
              :onrightclick "wl-copy \"${music.artist} - ${music.full_title}\""
 | 
			
		||||
              {music.title})
 | 
			
		||||
             (revealer
 | 
			
		||||
              :transition "slideright"
 | 
			
		||||
              :reveal music_control
 | 
			
		||||
              :duration "200ms"
 | 
			
		||||
              (music_controls)
 | 
			
		||||
              ))))
 | 
			
		||||
 | 
			
		||||
(defwindow music
 | 
			
		||||
           :stacking "overlay"
 | 
			
		||||
           :monitor 0
 | 
			
		||||
           :geometry (geometry
 | 
			
		||||
                      :x "0%"
 | 
			
		||||
                      :y "20px"
 | 
			
		||||
                      :width "0%"
 | 
			
		||||
                      :height "0%"
 | 
			
		||||
                      :anchor "top center")
 | 
			
		||||
           (music_large))
 | 
			
		||||
							
								
								
									
										187
									
								
								home/natto/eww/bar/system.yuck
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								home/natto/eww/bar/system.yuck
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,187 @@
 | 
			
		||||
(defvar system_sound_control false)
 | 
			
		||||
(defvar system_sound_mute false)
 | 
			
		||||
 | 
			
		||||
(defpoll volume :interval "3s"
 | 
			
		||||
         "wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}'")
 | 
			
		||||
 | 
			
		||||
(defwidget system_sound []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
            :onhover "${EWW_CMD} update system_sound_control=true"
 | 
			
		||||
            :onhoverlost "${EWW_CMD} update system_sound_control=false"
 | 
			
		||||
            :tooltip "${ system_sound_mute ? 'Muted' : 'Volume: ${volume}%'}"
 | 
			
		||||
            (box
 | 
			
		||||
             :space-evenly false
 | 
			
		||||
             :orientation "h"
 | 
			
		||||
             :class "system-sound"
 | 
			
		||||
             (revealer
 | 
			
		||||
              :transition "slideleft"
 | 
			
		||||
              :reveal system_sound_control
 | 
			
		||||
              :duration "250ms"
 | 
			
		||||
              (scale
 | 
			
		||||
               :class "system-scale"
 | 
			
		||||
               :min 0
 | 
			
		||||
               :max 151
 | 
			
		||||
               :onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%"
 | 
			
		||||
               :value {volume}
 | 
			
		||||
               ))
 | 
			
		||||
             (button
 | 
			
		||||
              ; since we do not know the initial state, we will just update the variable
 | 
			
		||||
              :onclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && ${EWW_CMD} update system_sound_mute=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $3 ~ /MUTED/ ? \"true\" : \"false\"}')"
 | 
			
		||||
              {system_sound_mute ? "" : volume > 75 ? "" : "" })
 | 
			
		||||
             )))
 | 
			
		||||
 | 
			
		||||
(defvar system_bright_control false)
 | 
			
		||||
 | 
			
		||||
(defpoll bright :interval "3s" "light")
 | 
			
		||||
 | 
			
		||||
(defwidget system_bright []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
            :onhover "${EWW_CMD} update system_bright_control=true"
 | 
			
		||||
            :onhoverlost "${EWW_CMD} update system_bright_control=false"
 | 
			
		||||
            :tooltip "Brightness: ${round(bright,0)}%"
 | 
			
		||||
            (box
 | 
			
		||||
             :space-evenly false
 | 
			
		||||
             :orientation "h"
 | 
			
		||||
             :class "system-bright"
 | 
			
		||||
             (revealer
 | 
			
		||||
              :transition "slideleft"
 | 
			
		||||
              :reveal system_bright_control
 | 
			
		||||
              :duration "250ms"
 | 
			
		||||
              (scale
 | 
			
		||||
               :class "system-scale"
 | 
			
		||||
               :min 5
 | 
			
		||||
               :max 101
 | 
			
		||||
               :onchange "light -S {}"
 | 
			
		||||
               :value {bright}
 | 
			
		||||
               ))
 | 
			
		||||
             (button
 | 
			
		||||
              :onclick "light -S ${bright < 51 ? 100 : 50}"
 | 
			
		||||
              ""))))
 | 
			
		||||
 | 
			
		||||
(defwidget system_temp []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
            :tooltip {EWW_TEMPS["CORETEMP_PACKAGE_ID_0"] != "" ? "CPU: ${EWW_TEMPS['CORETEMP_PACKAGE_ID_0']} C" : EWW_TEMPS}
 | 
			
		||||
            :class "system-temp"
 | 
			
		||||
            (button
 | 
			
		||||
             "")))
 | 
			
		||||
 | 
			
		||||
(defpoll system_net_ethernet :interval "4s" :initial ""
 | 
			
		||||
         "nmcli -f NAME,TYPE con show --active | awk '$NF == \"ethernet\" {NF--; print}'")
 | 
			
		||||
 | 
			
		||||
(defpoll system_net_wifi :interval "4s" :initial ""
 | 
			
		||||
         "nmcli -f NAME,TYPE con show --active | awk '$NF == \"wifi\" { NF--; print}'")
 | 
			
		||||
 | 
			
		||||
(defwidget system_net []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
            :class "system-net"
 | 
			
		||||
            :visible {system_net_ethernet != ""  || system_net_wifi != ""}
 | 
			
		||||
            :tooltip {EWW_NET}
 | 
			
		||||
            (box
 | 
			
		||||
             :orientation "h"
 | 
			
		||||
             (button
 | 
			
		||||
              :visible {system_net_ethernet != ""}
 | 
			
		||||
              :tooltip {system_net_ethernet}
 | 
			
		||||
              "")
 | 
			
		||||
             (button
 | 
			
		||||
              :visible {system_net_wifi != ""}
 | 
			
		||||
              :tooltip {system_net_wifi}
 | 
			
		||||
              :onclick "iwgtk &"
 | 
			
		||||
              ""))))
 | 
			
		||||
 | 
			
		||||
(defwidget system_info []
 | 
			
		||||
           (box
 | 
			
		||||
            :orientation "h"
 | 
			
		||||
            :space-evenly false
 | 
			
		||||
            :spacing 5
 | 
			
		||||
            (system_sound)
 | 
			
		||||
            (system_bright)
 | 
			
		||||
            (system_temp)))
 | 
			
		||||
 | 
			
		||||
(defpoll system_cpu_freq :interval "2s" :initial "0"
 | 
			
		||||
         "cat /proc/cpuinfo | awk '/cpu MHz/ { sum += $4; n++} END { if (n != 0) print sum / n; }'")
 | 
			
		||||
 | 
			
		||||
(defwidget system_metric [value class tooltip]
 | 
			
		||||
           (box
 | 
			
		||||
            :orientation "h"
 | 
			
		||||
            :space-evenly false
 | 
			
		||||
            :class "system-metric-${class}"
 | 
			
		||||
            :tooltip "${tooltip}"
 | 
			
		||||
            (circular-progress
 | 
			
		||||
             :value value
 | 
			
		||||
             :start-at 0
 | 
			
		||||
             :thickness 4
 | 
			
		||||
             (label :text ""))))
 | 
			
		||||
 | 
			
		||||
(defwidget system_metrics []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
            :class "system-metrics"
 | 
			
		||||
            :tooltip "test"
 | 
			
		||||
            :onclick "${EWW_CMD} open --toggle system"
 | 
			
		||||
            (box
 | 
			
		||||
             :space-evenly false
 | 
			
		||||
             (system_metric
 | 
			
		||||
              :value {EWW_CPU.avg}
 | 
			
		||||
              :tooltip "CPU Usage: ${round(EWW_CPU.avg, 2)}%${system_cpu_freq == '0' ? '' : '
 | 
			
		||||
CPU Freq: ${system_cpu_freq} MHz'}"
 | 
			
		||||
              :class "cpu")
 | 
			
		||||
             (system_metric
 | 
			
		||||
              :value {EWW_RAM.used_mem_perc}
 | 
			
		||||
              :tooltip "Free Memory: ${round(EWW_RAM.free_mem / 1024 / 1024, 2)} MB
 | 
			
		||||
Available Memory: ${round(EWW_RAM.available_mem / 1024 / 1024, 2)} MB
 | 
			
		||||
Free %: ${round(100 - EWW_RAM.used_mem_perc, 2)}%"
 | 
			
		||||
              :class "memory")
 | 
			
		||||
             (system_metric
 | 
			
		||||
              :value {EWW_BATTERY.total_avg}
 | 
			
		||||
              :tooltip "Battery ${round(EWW_BATTERY.total_avg, 0)}%"
 | 
			
		||||
              :class "battery")
 | 
			
		||||
             (system_metric
 | 
			
		||||
              :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
 | 
			
		||||
              :tooltip "Free Disk: ${round(EWW_DISK['/'].free / EWW_DISK['/'].total * 100, 2)} GB
 | 
			
		||||
Free Disk %: ${round(EWW_DISK['/'].free / EWW_DISK['/'].total * 100, 2)}%"
 | 
			
		||||
              :class "disk"))))
 | 
			
		||||
 | 
			
		||||
(defvar system_date_reveal false)
 | 
			
		||||
 | 
			
		||||
(defpoll time :interval "1s"
 | 
			
		||||
         "date '+%H:%M:%S'")
 | 
			
		||||
 | 
			
		||||
(defpoll date :interval "10m"
 | 
			
		||||
         "date '+%b %d'")
 | 
			
		||||
 | 
			
		||||
(defwidget system_time []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :onhover "${EWW_CMD} update system_date_reveal=true"
 | 
			
		||||
            :onhoverlost "${EWW_CMD} update system_date_reveal=false"
 | 
			
		||||
            (box
 | 
			
		||||
             :space-evenly false
 | 
			
		||||
             :orientation "h"
 | 
			
		||||
             :class "system-time"
 | 
			
		||||
             (label :class "system-time-time" :text {time})
 | 
			
		||||
             (revealer
 | 
			
		||||
              :transition "slideright"
 | 
			
		||||
              :reveal system_date_reveal
 | 
			
		||||
              :duration "250ms"
 | 
			
		||||
              (label :class "system-time-date" :text {date})))))
 | 
			
		||||
 | 
			
		||||
(defwidget system_separator [?visible] (box :class "system-separator" :visible {visible == "false" ? false : true}))
 | 
			
		||||
 | 
			
		||||
(defwidget system []
 | 
			
		||||
           (box
 | 
			
		||||
            :halign "end"
 | 
			
		||||
            :class "system"
 | 
			
		||||
            :space-evenly false
 | 
			
		||||
            :spacing 5
 | 
			
		||||
            (system_separator)
 | 
			
		||||
            (system_info)
 | 
			
		||||
            (system_separator
 | 
			
		||||
             :visible "${system_net_ethernet != "" || system_net_wifi != ""}")
 | 
			
		||||
            (system_net)
 | 
			
		||||
            (system_separator)
 | 
			
		||||
            (system_metrics)
 | 
			
		||||
            (system_separator)
 | 
			
		||||
            (system_time)))
 | 
			
		||||
							
								
								
									
										14
									
								
								home/natto/eww/bar/workspaces.yuck
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								home/natto/eww/bar/workspaces.yuck
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
(deflisten workspace "bar/hyprworkspaces")
 | 
			
		||||
(defvar numerals "[\"१\", \"२\", \"३\", \"४\", \"५\", \"६\", \"७\", \"८\", \"९\", \"०\"]")
 | 
			
		||||
 | 
			
		||||
(defwidget workspaces []
 | 
			
		||||
           (eventbox
 | 
			
		||||
            :cursor "pointer"
 | 
			
		||||
		        (box
 | 
			
		||||
             :class "workspaces"
 | 
			
		||||
		         (for ws in {workspace.list}
 | 
			
		||||
		              (button
 | 
			
		||||
                   :class "${ws == workspace.current ? 'workspace-active' : 'workspace-inactive'}"
 | 
			
		||||
					         :onclick "hyprctl dispatch workspace ${ws}"
 | 
			
		||||
					         {ws <= 10 ? numerals[ws - 1] : ws }))
 | 
			
		||||
             )))
 | 
			
		||||
							
								
								
									
										36
									
								
								home/natto/eww/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								home/natto/eww/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{ config, pkgs, lib, ... }:
 | 
			
		||||
{
 | 
			
		||||
  programs.eww = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    package = pkgs.eww-wayland;
 | 
			
		||||
    configDir = lib.cleanSourceWith {
 | 
			
		||||
      src = ./.;
 | 
			
		||||
      filter = name: _:
 | 
			
		||||
        let
 | 
			
		||||
          baseName = baseNameOf (toString name);
 | 
			
		||||
        in
 | 
			
		||||
          !(lib.hasSuffix ".nix" baseName);
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  systemd.user.services.eww = {
 | 
			
		||||
    Unit = {
 | 
			
		||||
      Description = "EWW Daemon";
 | 
			
		||||
    };
 | 
			
		||||
    Service =
 | 
			
		||||
      let
 | 
			
		||||
        deps = [
 | 
			
		||||
          config.programs.eww.package
 | 
			
		||||
          config.wayland.windowManager.hyprland.package
 | 
			
		||||
        ] ++ (import ./bar pkgs);
 | 
			
		||||
      in
 | 
			
		||||
      {
 | 
			
		||||
        Environment = "PATH=${lib.makeBinPath deps}";
 | 
			
		||||
        Type = "simple";
 | 
			
		||||
        Restart = "on-failure";
 | 
			
		||||
        ExecStart = "${config.programs.eww.package}/bin/eww daemon --no-daemonize";
 | 
			
		||||
      };
 | 
			
		||||
    Install.WantedBy = [ "graphical-session.target" ];
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								home/natto/eww/eww.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								home/natto/eww/eww.scss
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
@import "bar/bar.scss"
 | 
			
		||||
							
								
								
									
										1
									
								
								home/natto/eww/eww.yuck
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								home/natto/eww/eww.yuck
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
(include "bar/bar.yuck")
 | 
			
		||||
		Reference in New Issue
	
	Block a user