about summary refs log tree commit diff stats
path: root/home-manager
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-04-23 14:08:56 +0200
committerSoispha <soispha@vhack.eu>2023-05-09 19:31:46 +0200
commit00ca805216eda639f132676e3394ee93f6ff10ff (patch)
tree4a25bb24970af42c6d01d36ad0aedd800e693a46 /home-manager
parentFeat(hm/wms/river): Bump runtime error to compile time (diff)
downloadnixos-config-00ca805216eda639f132676e3394ee93f6ff10ff.tar.gz
nixos-config-00ca805216eda639f132676e3394ee93f6ff10ff.zip
Fix(hm/conf/yambar): Use different config on laptops
Diffstat (limited to '')
-rw-r--r--home-manager/config/yambar/config/config.yml.diffrent56
-rw-r--r--home-manager/config/yambar/config/laptop.yml169
-rw-r--r--home-manager/config/yambar/default.nix11
3 files changed, 152 insertions, 84 deletions
diff --git a/home-manager/config/yambar/config/config.yml.diffrent b/home-manager/config/yambar/config/config.yml.diffrent
deleted file mode 100644
index 462a329b..00000000
--- a/home-manager/config/yambar/config/config.yml.diffrent
+++ /dev/null
@@ -1,56 +0,0 @@
-hack: &hack Hack Nerd Font:pixelsize=13
-bg_default: &bg_default {stack: [{background: {color: 81A1C1ff}}, {underline: {size: 4, color: D8DEE9ff}}]}
-bar:
-  height: 40
-  location: top
-  font: JuliaMono:pixelsize=10
-  spacing: 2
-  margin: 0
-  layer: bottom
-  foreground: eeeeeeff
-  background: 2E3440dd
-
-  left:
-    - river:
-        anchors:
-          - base: &river_base
-              left-margin: 10
-              right-margin: 13 
-              default: {string: {text: , font: *hack}}
-              conditions:
-                id == 1: {string: {text: ﳐ, font: *hack}}  
-                id == 2: {string: {text: , font: *hack}}  
-                id == 3: {string: {text: , font: *hack}}  
-                id == 4: {string: {text: , font: *hack}}  
-                id == 5: {string: {text: , font: *hack}}  
-                id == 10: {string: {text: "scratchpad", font: *hack}}  
-                id == 11: {string: {text: "work", font: *hack}}  
-
-        content:
-          map:
-            on-click: 
-              left: sh -c "riverctl set-focused-tags $((1 << ({id} - 1)))"
-              right: sh -c "riverctl toggle-focused-tags $((1 << ({id} -1)))"
-              middle: sh -c "riverctl toggle-view-tags $((1 << ({id} -1)))"
-            conditions:
-              state == urgent:
-                map:
-                  <<: *river_base
-                  deco: {background: {color: D08770ff}}
-              state == focused:
-                map:
-                  <<: *river_base
-                  deco: *bg_default
-              state == visible:
-                map:
-                  conditions:
-                    ~occupied: {map: {<<: *river_base}}
-                    occupied: {map: {<<: *river_base, deco: *bg_default}}
-              state == unfocused:
-                map:
-                  <<: *river_base
-              state == invisible:
-                map:
-                  conditions:
-                    ~occupied: {empty: {}}
-                    occupied: {map: {<<: *river_base, deco: {underline: {size: 3, color: ea6962ff}}}}
diff --git a/home-manager/config/yambar/config/laptop.yml b/home-manager/config/yambar/config/laptop.yml
index c3bfe6ab..2a1cef58 100644
--- a/home-manager/config/yambar/config/laptop.yml
+++ b/home-manager/config/yambar/config/laptop.yml
@@ -1,9 +1,10 @@
+---
 # Config file for yambar
 # Note that this may be version-dependent, this file is written for v1.8.0
 
 
 # Font anchors
-font-main: &fontmain DejavuSansMono:pixelsize=22
+font-main: &fontmain Source Code Pro:pixelsize=22
 font-aws: &awesome Font Awesome 5 Free:style=solid:pixelsize=20
 
 # Color anchors
@@ -50,7 +51,6 @@ bar:
   location: top
   height: 25
   layer: bottom
-  monitor: DP-2
   spacing: 0
   margin: 10
   border: {margin: 0, top-margin: 5}
@@ -71,38 +71,34 @@ bar:
           - string: &focused { string: { <<: *name, deco: {stack: [background: {color: *bgtag}, <<: *line]}, margin: 10 } }
           - string: &unfocused { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } }
           - base: &river_base
-              tag: state
               default: *normal
-              values:
-                focused: *focused
-                unfocused: *unfocused
-                urgent: *urgent
-                invisible:
+              conditions:
+                state == focused: *focused
+                state == unfocused: *unfocused
+                state == urgent: *urgent
+                state == invisible:
                   map:
-                    tag: occupied
-                    values:
-                      true: *occupied
-                      false: *normal
+                    conditions:
+                      occupied: *occupied
+                      ~occupied: *normal
         content:
           map:
             on-click:
               left: sh -c "riverctl set-focused-tags $((1 << ({id} - 1)))"
               right: sh -c "riverctl toggle-focused-tags $((1 << ({id} -1)))"
               middle: sh -c "riverctl toggle-view-tags $((1 << ({id} -1)))"
-            tag: id
-            values:
-              1: { map: { <<: *river_base } }
-              2: { map: { <<: *river_base } }
-              3: { map: { <<: *river_base } }
-              4: { map: { <<: *river_base } }
-              5: { map: { <<: *river_base } }
-              6: { map: { <<: *river_base } }
-              7: { map: { <<: *river_base } }
-              8: { map: { <<: *river_base } }
-              9: { map: { <<: *river_base } }
+            conditions:
+              id == 1: { map: { <<: *river_base } }
+              id == 2: { map: { <<: *river_base } }
+              id == 3: { map: { <<: *river_base } }
+              id == 4: { map: { <<: *river_base } }
+              id == 5: { map: { <<: *river_base } }
+              id == 6: { map: { <<: *river_base } }
+              id == 7: { map: { <<: *river_base } }
+              id == 8: { map: { <<: *river_base } }
+              id == 9: { map: { <<: *river_base } }
         title:
           map:
-            tag: title
             default:
               {
                 string:
@@ -110,8 +106,129 @@ bar:
                     text: "{title}",
                     left-margin: 12,
                     right-margin: 12,
-                      #max: 35,
+                    # max: 35,
                     deco: *linetitle
                   },
               }
-            values: { "": { string: { text: "" } } }
+            conditions:
+              title == "": { string: { text: "" } }
+
+  ### Center, clock & weather gadget
+  center:
+    - clock:
+        time-format: "%H:%M:%S %Z"
+        date-format: "%d/%m/%y (%a)"
+        foreground: *fgblue
+        content:
+          string:
+            text: " {date} {time} "
+            deco: *combclock
+
+  ### Right, system tray
+  right:
+    #- network:
+    #    name: wlp5s0
+    #    poll-interval: 10
+    #    content:
+    #      map:
+    #        on-click: /bin/sh -c "nmtui"
+    #        conditions:
+    #          ~carrier: {empty: {}}
+    #          carrier:
+    #            string: {text: "  {ssid} ", deco: *combutil}
+    #- network:
+    #    name: enp4s0
+    #    content:
+    #      map:
+    #        on-click: /bin/sh -c "nmtui"
+    #        conditions:
+    #          ~carrier:
+    #            string: {text: "  Eth failed ", deco: *combutil}
+    #          carrier: {empty: {}}
+
+    - script:   # Sound volume
+        path: @volume_script@
+        content:
+          map:
+            on-click: /bin/sh -c "pavucontrol"
+            conditions:
+              muted:
+                string:
+                  text: " ﱝ "
+                  deco: *bgcurg
+              ~muted:
+                string: {text: "  {volume}% ", deco: *combutil}
+
+    - script:   # Grade average
+        path: @grade_average_script@
+        content:
+          string:
+            text: "   {grade} "
+            deco: *combmem
+
+    - backlight:
+       name: @backlight@
+       content:
+         - string: {text: "  {percent}% ", deco: *combutil}
+
+    - script:   # CPU
+        path: @cpu_script@
+        content:
+          string:
+            text: "  {cpu}% "
+            deco: *combmem
+
+    - script:   # Memory info
+        path: @memory_script@
+        content:
+          map:
+            conditions:
+              swapstate:
+                string:
+                  text: "  {memperc}%({swapperc}%) "
+                  deco: *combmem
+              ~swapstate:
+                string:
+                  text: "  {memperc}% "
+                  deco: *combmem
+    - script:   # Disk space
+        path: @disk_script@
+        content:
+          string:
+            text: "  {diskspace}({diskperc})"
+            deco: *combmem
+   - battery:
+       name: BAT0
+       poll-interval: 30
+       content:
+         list:
+           items:
+             - ramp:
+                 tag: capacity
+                 items:
+                   - string:
+                       text: "  {capacity}%({estimate}) "
+                       deco: *bgcurg
+                   - string:
+                       text: "  {capacity}%({estimate}) "
+                       deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+                   - string:
+                       text: "  {capacity}%({estimate}) "
+                       deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+                   - string:
+                       text: "  {capacity}%({estimate}) "
+                       deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+                   - string:
+                       text: "  {capacity}%({estimate}) "
+                       deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+   #- script:   # tray
+   #    path: /home/dt/.config/yambar/scripts/yambar-tray
+   #    content:
+   #      empty: {}
+   #- script:
+   #    path: /home/dt/.config/yambar/scripts/yambar-tray-width
+   #    poll-interval: 10
+   #    content:
+   #      string:
+   #         text: "{padding}"
+   #         deco: *combmem
diff --git a/home-manager/config/yambar/default.nix b/home-manager/config/yambar/default.nix
index 977d39a9..f11a3300 100644
--- a/home-manager/config/yambar/default.nix
+++ b/home-manager/config/yambar/default.nix
@@ -1,5 +1,5 @@
 {
-  config,
+  nixosConfig,
   sysLib,
   system,
   pkgs,
@@ -21,8 +21,15 @@
     + "/bin/${builtins.baseNameOf file}";
 in {
   xdg.configFile."yambar/config.yml".source = pkgs.substituteAll {
-    src = ./config/config.yml;
+    src =
+      if nixosConfig.soispha.laptop.enable
+      then ./config/laptop.yml
+      else ./config/config.yml;
 
+    backlight =
+      if nixosConfig.soispha.laptop.enable
+      then nixosConfig.soispha.laptop.backlight
+      else "";
     volume_script = makeScript {
       dependencies = builtins.attrValues {inherit (pkgs) pulseaudio gawk coreutils;};
       file = ./scripts/sound-volume;