Browse Source

add eww alsa widget

siduck76 3 năm trước cách đây
mục cha
commit
409d02ae87
6 tập tin đã thay đổi với 135 bổ sung0 xóa
  1. 66 0
      eww/eww.scss
  2. 61 0
      eww/eww.yuck
  3. 2 0
      eww/scripts/get_brightness
  4. 2 0
      eww/scripts/get_headvol
  5. 2 0
      eww/scripts/get_mastervol
  6. 2 0
      eww/scripts/getram

+ 66 - 0
eww/eww.scss

@@ -0,0 +1,66 @@
+* {
+  all: unset; //Unsets everything so you can style everything from scratch
+}
+
+//Global Styles
+.alsa-gui {
+  background-color: #1e222a;
+  color: #abb2bf;
+  padding: 12px;
+  border-radius: 7px;
+  font-size : 25px;
+}
+
+.metric scale trough {
+  all: unset;
+  border-radius: 50px;
+  min-height: 3px;
+  min-width: 90px;
+  margin-left: 10px;
+  margin-right: 10px;
+}
+
+.chad scale trough {
+  all: unset;
+  border-radius: 50px;
+  min-height: 3px;
+  min-width: 90px;
+  margin-left: 10px;
+  margin-right: 10px;
+}
+
+.metric scale trough highlight {
+  all: unset;
+  background-color: #668ee3;
+  border-radius: 10px;
+}
+
+.chad scale trough highlight {
+  all: unset;
+  background-color: #e06c75;
+  border-radius: 10px;
+}
+
+.bri  {
+  background-color: #d47d85;
+}
+
+.metric scale trough {
+  all: unset;
+  background-color: #282c34;
+  border-radius: 50px;
+  min-height: 6px;
+  min-width: 90px;
+  margin-left: 10px;
+  margin-right: 10px;
+}
+
+.chad scale trough {
+  all: unset;
+  background-color: #282c34;
+  border-radius: 50px;
+  min-height: 6px;
+  min-width: 90px;
+  margin-left: 10px;
+  margin-right: 10px;
+}

+ 61 - 0
eww/eww.yuck

@@ -0,0 +1,61 @@
+(defwidget chad-widgets []
+  (box :orientation "h"
+    (sliders)))
+
+(defwidget sliders []
+  (box :class "master_vol" :orientation "v" :space-evenly false :halign "end"
+    (metric :label ""
+            :value master_vol
+            :onchange "amixer set Master {}%")
+      
+    (metric :label ""
+            :value head_vol
+            :onchange "amixer set Headphone {}%")
+  
+    (chad :label "" 
+             :value brightness
+             :onchange "xbacklight -set {}%")
+  )
+)
+
+(defwidget chad [label value onchange]
+  (box :orientation "h"
+       :class "chad"
+       :space-evenly false
+    (box :class "label" label)
+    (scale :min 0
+           :max 101
+           :active {onchange != ""}
+           :value value
+           :onchange onchange)))
+
+(defwidget metric [label value onchange]
+  (box :orientation "h"
+       :class "metric"
+       :space-evenly false
+    (box :class "label" label)
+    (scale :min 0
+           :max 101
+           :active {onchange != ""}
+           :value value
+           :onchange onchange)))
+
+(defpoll master_vol :interval "1s"
+  "scripts/get_mastervol")
+
+(defpoll head_vol :interval "1s"
+  "scripts/get_headvol")
+
+(defpoll brightness :interval "1s"
+  "scripts/get_brightness")
+
+(defwindow alsa-gui
+  :monitor 0
+  :windowtype "dock"
+  :geometry (geometry :x "-01%"
+                      :y "8%"
+                      :width "5%"
+                      :height "0px"
+                      :anchor "top right")
+  ; :reserve (struts :side "right" :distance "0%")
+  (chad-widgets))

+ 2 - 0
eww/scripts/get_brightness

@@ -0,0 +1,2 @@
+#!/bin/sh
+printf "%.0f\n" $(xbacklight -get)

+ 2 - 0
eww/scripts/get_headvol

@@ -0,0 +1,2 @@
+#!/bin/sh
+amixer sget Headphone | grep 'Left:' | cut -d\  -f7 | tr -d '[%]'

+ 2 - 0
eww/scripts/get_mastervol

@@ -0,0 +1,2 @@
+#!/bin/sh
+amixer get Master | awk '$0~/%/{print $4}' | tr -d '[%]'

+ 2 - 0
eww/scripts/getram

@@ -0,0 +1,2 @@
+#!/bin/sh
+printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')