yep, more dotfiles
1{ config 2, lib 3, pkgs 4, ... 5}: 6 7let 8 cfg = config.local.fragment.swaybar; 9 10 integrated-keyboard-id = "1:1:AT_Translated_Set_2_keyboard"; 11 integrated-keyboard-id-bis = "1:1:kanata"; 12 13 swaymsg = lib.getExe' pkgs.sway "swaymsg"; 14in 15{ 16 options.local.fragment.swaybar.enable = lib.mkEnableOption '' 17 Swaybar related 18 ''; 19 20 config = lib.mkIf cfg.enable { 21 programs.i3status-rust = { 22 enable = true; 23 24 bars.default = { 25 theme = "modern"; 26 icons = "awesome6"; 27 28 settings.icon_format = " <span font_family='FontAwesome6'>{icon}</span> "; 29 30 blocks = [ 31 { 32 block = "custom"; 33 command = '' 34 echo 󰌌 $(swaymsg --raw --type get_inputs \ 35 | jq --raw-output ' 36 .[] 37 | select(.identifier=="${integrated-keyboard-id}") 38 | .libinput.send_events') 39 ''; 40 click = [{ 41 button = "left"; 42 cmd = '' 43 ${swaymsg} input ${integrated-keyboard-id} events toggle; 44 ${swaymsg} input ${integrated-keyboard-id-bis} events toggle 45 ''; 46 update = true; 47 }]; 48 interval = "once"; 49 } 50 51 { 52 block = "custom"; 53 command = "echo $(${lib.getExe' pkgs.mako "makoctl"} mode)"; 54 click = [{ 55 button = "left"; 56 # Toggle DND mode 57 cmd = "${lib.getExe' pkgs.mako "makoctl"} mode -t dnd"; 58 update = true; 59 }]; 60 interval = "once"; 61 } 62 63 { block = "music"; } 64 { 65 format = " 󰌌 $variant"; 66 block = "keyboard_layout"; 67 driver = "sway"; 68 } 69 { block = "backlight"; device = "intel_backlight"; } 70 { block = "sound"; } 71 { block = "battery"; } 72 { 73 block = "time"; 74 interval = 60; 75 format = " $timestamp.datetime(f:'%a %d/%m %R') "; 76 } 77 ]; 78 }; 79 }; 80 81 wayland.windowManager.sway.config.bars = [ 82 ({ 83 statusCommand = "${lib.getExe pkgs.i3status-rust} ${config.home.homeDirectory}/${config.xdg.configFile."i3status-rust/config-default.toml".target}"; 84 85 hiddenState = "hide"; 86 mode = "hide"; 87 88 # TODO: fix color theme on the bar 89 # TODO: would be nice to have rounded corners and padding when appearing 90 91 extraConfig = "icon_theme Papirus"; 92 } // config.stylix.targets.sway.exportedBarConfig) 93 ]; 94 }; 95}