summaryrefslogtreecommitdiff
path: root/modules/home-manager/personal/gui/x/i3/bar.nix
diff options
context:
space:
mode:
authoraristote <quentin.aristote@irif.fr>2025-07-30 00:13:04 +0200
committeraristote <quentin.aristote@irif.fr>2025-07-30 00:13:04 +0200
commit9c088d044873ed84a8ae411e815c41ec558eed29 (patch)
tree65d0bc0af6813e5d6c3ec7f85d65cffdc9f20bbd /modules/home-manager/personal/gui/x/i3/bar.nix
parent07cb81a1d95e15e7c864dcfd912fc2a22d65d115 (diff)
parent414e9b5ae2c3a565c5826027c7e1f775cdafc32a (diff)
Merge branch 'i3bar'
Diffstat (limited to 'modules/home-manager/personal/gui/x/i3/bar.nix')
-rw-r--r--modules/home-manager/personal/gui/x/i3/bar.nix101
1 files changed, 101 insertions, 0 deletions
diff --git a/modules/home-manager/personal/gui/x/i3/bar.nix b/modules/home-manager/personal/gui/x/i3/bar.nix
new file mode 100644
index 0000000..2389a8a
--- /dev/null
+++ b/modules/home-manager/personal/gui/x/i3/bar.nix
@@ -0,0 +1,101 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+let
+ cfg = config.personal.x.i3;
+ cfgStylix = config.stylix.targets.i3;
+ mkDeviceOption = lib.mkOption {
+ type = with lib.types; nullOr str;
+ default = null;
+ };
+ ifDevice = device: attrs: lib.optional (device != null) ({ inherit device; } // attrs);
+in
+{
+ options.personal.x.i3 = {
+ devices = {
+ wifi = mkDeviceOption;
+ eth = mkDeviceOption;
+ vpn = mkDeviceOption // {
+ default = "tun0";
+ };
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ xsession.windowManager.i3.config.bars = [
+ {
+ statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
+ fonts = { inherit (cfgStylix.exportedBarConfig.fonts) size; };
+ }
+ ];
+
+ programs.i3status-rust = {
+ enable = true;
+ bars = {
+ default = {
+ icons = "material-nf";
+ blocks =
+ (ifDevice cfg.devices.wifi {
+ block = "net";
+ device = cfg.devices.wifi;
+ format = " ^icon_net_wireless $ssid ";
+ })
+ ++ (ifDevice cfg.devices.eth {
+ block = "net";
+ device = cfg.devices.eth;
+ format = " ^icon_net_wired $ip ";
+ inactive_format = " ^icon_net_wired × ";
+ missing_format = " ^icon_net_wired × ";
+ })
+ ++ (ifDevice cfg.devices.vpn {
+ block = "net";
+ device = cfg.devices.vpn;
+ format = " ^icon_net_vpn $ip ";
+ inactive_format = " ^icon_net_vpn × ";
+ missing_format = " ^icon_net_vpn × ";
+ })
+ ++ [
+ {
+ block = "disk_space";
+ info_type = "used";
+ path = "/";
+ warning = 50.0;
+ alert = 90.0;
+ format = " $icon $percentage ";
+ }
+ (
+ let
+ format = " $icon $percentage ";
+ in
+ {
+ block = "battery";
+ inherit format;
+ full_format = format;
+ charging_format = format;
+ empty_format = format;
+ not_charging_format = format;
+ }
+ )
+ {
+ block = "backlight";
+ }
+ {
+ block = "sound";
+ }
+ {
+ block = "sound";
+ }
+ {
+ block = "time";
+ interval = 1;
+ format = " $timestamp.datetime(f:'%a. %b. %d, %H:%M:%S') ";
+ }
+ ];
+ };
+ };
+ };
+ };
+}