about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-02-09 19:48:36 -0800
committerFranck Cuny <franck@fcuny.net>2022-02-09 19:48:36 -0800
commitbcf28f0a088411ec2fa956ad7a79b7287b5ca1eb (patch)
tree20c1be54815e55a48fbedfe6898a3f4d2afe3856
parentdesktop: configure GTK (diff)
downloadworld-bcf28f0a088411ec2fa956ad7a79b7287b5ca1eb.tar.gz
home-manager: let's try to configure polybar
There's a few things missing (my binaries for the wifi and battery, at a
minimum), but that's fine for now.
-rw-r--r--configs/polybar/aptos.conf37
-rw-r--r--configs/polybar/carmel.conf36
-rw-r--r--configs/polybar/modules/battery.ini4
-rw-r--r--configs/polybar/modules/bluetooth.ini5
-rw-r--r--configs/polybar/modules/colors.ini7
-rw-r--r--configs/polybar/modules/date.ini6
-rw-r--r--configs/polybar/modules/i3.ini20
-rw-r--r--configs/polybar/modules/mpd.ini6
-rw-r--r--configs/polybar/modules/pulseaudio.ini8
-rw-r--r--configs/polybar/modules/wired.ini10
-rw-r--r--configs/polybar/modules/wireless.ini4
-rw-r--r--users/fcuny/i3.nix31
12 files changed, 163 insertions, 11 deletions
diff --git a/configs/polybar/aptos.conf b/configs/polybar/aptos.conf
new file mode 100644
index 0000000..04c35fe
--- /dev/null
+++ b/configs/polybar/aptos.conf
@@ -0,0 +1,37 @@
+include-file = ~/.config/polybar/modules/battery.ini
+include-file = ~/.config/polybar/modules/bluetooth.ini
+include-file = ~/.config/polybar/modules/colors.ini
+include-file = ~/.config/polybar/modules/date.ini
+include-file = ~/.config/polybar/modules/i3.ini
+include-file = ~/.config/polybar/modules/mpd.ini
+include-file = ~/.config/polybar/modules/pulseaudio.ini
+include-file = ~/.config/polybar/modules/wireless.ini
+
+[settings]
+screenchange-reload = false
+
+[bar/common]
+enable-ipc = true
+width = 100%
+monitor = ${env:MONITOR:}
+monitor-strict = true
+dpi = ${env:DPI:}
+border-size = 0
+tray-position = none
+fixed-center = true
+module-margin = 1
+padding-right = 1
+line-size = 3
+
+background = ${colors.background}
+foreground = ${colors.foreground}
+
+font-0 = Source Code Pro:style=Regular:size=10;2
+
+modules-left = i3
+
+modules-center = mpd
+
+[bar/alone]
+inherit = bar/common
+modules-right = network bluetooth pulseaudio battery date
diff --git a/configs/polybar/carmel.conf b/configs/polybar/carmel.conf
new file mode 100644
index 0000000..d09f796
--- /dev/null
+++ b/configs/polybar/carmel.conf
@@ -0,0 +1,36 @@
+include-file = ~/.config/polybar/modules/colors.ini
+include-file = ~/.config/polybar/modules/date.ini
+include-file = ~/.config/polybar/modules/i3.ini
+include-file = ~/.config/polybar/modules/mpd.ini
+include-file = ~/.config/polybar/modules/pulseaudio.ini
+include-file = ~/.config/polybar/modules/wired.ini
+
+[settings]
+screenchange-reload = false
+
+[bar/common]
+enable-ipc = true
+width = 100%
+monitor = ${env:MONITOR:}
+monitor-strict = true
+dpi = ${env:DPI:}
+border-size = 0
+tray-position = none
+fixed-center = true
+module-margin = 1
+padding-right = 1
+
+background = ${colors.background}
+foreground = ${colors.foreground}
+
+font-0 = Source Code Pro:style=Regular:size=8;2
+font-1 = Font Awesome 5 Free:style=Solid:pixelsize=8;3
+font-2 = Material\-Design\-Iconic\-Font:size=8;2
+
+modules-left = i3
+
+modules-center = mpd
+
+[bar/alone]
+inherit = bar/common
+modules-right = wired-network pulseaudio date
diff --git a/configs/polybar/modules/battery.ini b/configs/polybar/modules/battery.ini
new file mode 100644
index 0000000..8c7e84a
--- /dev/null
+++ b/configs/polybar/modules/battery.ini
@@ -0,0 +1,4 @@
+[module/battery]
+type = custom/script
+exec = /home/fcuny/workspace/go/bin/polybar-bat
+interval = 10
diff --git a/configs/polybar/modules/bluetooth.ini b/configs/polybar/modules/bluetooth.ini
new file mode 100644
index 0000000..9a82955
--- /dev/null
+++ b/configs/polybar/modules/bluetooth.ini
@@ -0,0 +1,5 @@
+[module/bluetooth]
+type = custom/script
+exec = ~/.config/rofi/scripts/bluetooth --status
+interval = 1
+click-left = ~/.config/rofi/scripts/bluetooth &
diff --git a/configs/polybar/modules/colors.ini b/configs/polybar/modules/colors.ini
new file mode 100644
index 0000000..2b15171
--- /dev/null
+++ b/configs/polybar/modules/colors.ini
@@ -0,0 +1,7 @@
+[colors]
+background = #000000
+foreground = #FFFFF8
+highlight = #4c7899
+warning = #ff3121
+focused = #4c7899
+disabled = #90a1ad
diff --git a/configs/polybar/modules/date.ini b/configs/polybar/modules/date.ini
new file mode 100644
index 0000000..c5b28da
--- /dev/null
+++ b/configs/polybar/modules/date.ini
@@ -0,0 +1,6 @@
+[module/date]
+type = internal/date
+interval = 2
+time = %H:%M
+date = %a %b %d
+label = %date% %time%
diff --git a/configs/polybar/modules/i3.ini b/configs/polybar/modules/i3.ini
new file mode 100644
index 0000000..7e24a4a
--- /dev/null
+++ b/configs/polybar/modules/i3.ini
@@ -0,0 +1,20 @@
+[module/i3]
+type = internal/i3
+format = <label-state> <label-mode>
+index-sort = true
+wrapping-scroll = false
+pin-workspaces = true
+
+label-mode-background = ${colors.highlight}
+label-mode-padding = 1
+label-focused = %name%
+label-focused-background = ${colors.focused}
+label-focused-padding = 1
+label-unfocused = %name%
+label-unfocused-padding = 1
+label-visible = %name%
+label-visible-background = ${colors.highlight}
+label-visible-padding = 1
+label-urgent = %name%
+label-urgent-background = #a00000
+label-urgent-padding = 1
diff --git a/configs/polybar/modules/mpd.ini b/configs/polybar/modules/mpd.ini
new file mode 100644
index 0000000..05f066d
--- /dev/null
+++ b/configs/polybar/modules/mpd.ini
@@ -0,0 +1,6 @@
+[module/mpd]
+type = internal/mpd
+socket = /var/run/user/1000/mpd/socket
+interval = 2
+label-song = %artist% / %title%
+format-online = <label-song>
diff --git a/configs/polybar/modules/pulseaudio.ini b/configs/polybar/modules/pulseaudio.ini
new file mode 100644
index 0000000..41d02b6
--- /dev/null
+++ b/configs/polybar/modules/pulseaudio.ini
@@ -0,0 +1,8 @@
+[module/pulseaudio]
+type = internal/pulseaudio
+use-ui-max = false
+format-volume = <label-volume>
+label-volume = "vol/%percentage%%"
+label-muted = "vol/%percentage%%"
+label-muted-foreground = ${colors.disabled}
+click-right = pavucontrol
diff --git a/configs/polybar/modules/wired.ini b/configs/polybar/modules/wired.ini
new file mode 100644
index 0000000..f9f1db0
--- /dev/null
+++ b/configs/polybar/modules/wired.ini
@@ -0,0 +1,10 @@
+[module/wired-network]
+type = internal/network
+interface = enp9s0
+
+format-connected =<label-connected>
+label-connected = "%local_ip%"
+format-disconnected = <label-disconnected>
+label-disconnected = "%ifname%"
+format-disconnected-foreground = #121212
+format-disconnected-background = #ff6961
diff --git a/configs/polybar/modules/wireless.ini b/configs/polybar/modules/wireless.ini
new file mode 100644
index 0000000..95b0f09
--- /dev/null
+++ b/configs/polybar/modules/wireless.ini
@@ -0,0 +1,4 @@
+[module/network]
+type = custom/script
+exec = /home/fcuny/workspace/go/bin/polybar-wifi
+interval = 10
diff --git a/users/fcuny/i3.nix b/users/fcuny/i3.nix
index b3ac043..cea7897 100644
--- a/users/fcuny/i3.nix
+++ b/users/fcuny/i3.nix
@@ -8,10 +8,17 @@ in
   xsession.windowManager.i3 = {
     enable = true;
     config = {
+      modified = mod;
       terminal = "${pkgs.alacritty}/bin/alacritty";
+      window = {
+        titlebar = false;
+        border = 2;
+      };
       keybindings = lib.mkOptionDefault {
         "${mod}+r" = "exec --no-startup-id ${pkgs.rofi}/bin/rofi -show drun";
+        "${mod}+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session";
       };
+      bars = [ ];
     };
   };
 
@@ -26,19 +33,21 @@ in
     };
   };
 
+  config.xdg.configFile."polybar/aptos.ini".source = ../../configs/polybar/aptos.ini;
+  config.xdg.configFile."polybar/carmel.ini".source = ../../configs/polybar/carmel.ini;
+  config.xdg.configFile."polybar/modules/battery.ini".source = ../../configs/polybar/modules/battery.ini;
+  config.xdg.configFile."polybar/modules/bluetooth.ini".source = ../../configs/polybar/modules/bluetooth.ini;
+  config.xdg.configFile."polybar/modules/colors.ini".source = ../../configs/polybar/modules/colors.ini;
+  config.xdg.configFile."polybar/modules/date.ini".source = ../../configs/polybar/modules/date.ini;
+  config.xdg.configFile."polybar/modules/i3.ini".source = ../../configs/polybar/modules/i3.ini;
+  config.xdg.configFile."polybar/modules/mpd.ini".source = ../../configs/polybar/modules/mpd.ini;
+  config.xdg.configFile."polybar/modules/pulseaudio.ini".source = ../../configs/polybar/modules/pulseaudio.ini;
+  config.xdg.configFile."polybar/modules/wired.ini".source = ../../configs/polybar/modules/wired.ini;
+  config.xdg.configFile."polybar/modules/wireless.ini".source = ../../configs/polybar/modules/wireless.ini;
+
   services.polybar = {
     enable = true;
     package = pkgs.polybarFull;
-    script = "";
-    config =  {
-      "bar/main" = {
-        background = "#000000";
-        foreground = "#fafafa";
-      };
-      "module/pulseaudio" = {
-        type = "internal/pulseaudio";
-        use-ui-max = false;
-      };
-    };
+    script = "polybar --config=${config.xdg.configFile."polybar/config".source}/${config.hostname}.conf &";
   };
 }