From 97af92924a0a6005e37813ffa74619104b3123de Mon Sep 17 00:00:00 2001 From: vorboyvo Date: Wed, 7 Feb 2024 13:00:22 -0500 Subject: [PATCH] Configured bluetooth with blueman Added font-awesome Added and configured waybar to replace swaybar as status bar, giving it a config not unlike that of swaybar previously --- home.nix | 6 ++- programs/sway.nix | 2 +- programs/waybar.nix | 111 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 programs/waybar.nix diff --git a/home.nix b/home.nix index 89d6014..2637e96 100644 --- a/home.nix +++ b/home.nix @@ -23,14 +23,14 @@ in [ gcc tree-sitter ] ++ # Basic dev tools [ texliveFull ] ++ # TeX distribution (with ocamlPackages; [ ocaml opam dune_3 dune-release merlin ocaml-lsp odoc ocamlformat utop ]) ++ # OCaml - [ grim slurp wl-clipboard jq (callPackage ./pkgs/xdg-terminal-exec/xdg-terminal-exec.nix {}) ] ++ # Basic utilities + [ grim slurp wl-clipboard jq (callPackage ./pkgs/xdg-terminal-exec/xdg-terminal-exec.nix {}) blueman ] ++ # Basic utilities [ bitwarden-cli ] ++ # Personalized selection of command-line (CLI/TUI) apps [ terminal ] ++ # Terminal emulator [ firefox cinnamon.nemo gnome.file-roller cinnamon.nemo-fileroller imv vlc pavucontrol ] ++ # Basic graphical apps [ libreoffice signal-desktop element-desktop prismlauncher mumble gimp inkscape ] ++ # Personalized selection of graphical apps [ (callPackage ./pkgs/mons/mons.nix {}) ] ++ # Games [ swaybg bemenu j4-dmenu-desktop fcitx5-with-addons ] ++ # Sway- and Wayland-related packages - [ noto-fonts redhat-official-fonts overpass ibm-plex ] ++ # Fonts + [ noto-fonts redhat-official-fonts overpass ibm-plex font-awesome ] ++ # Fonts [ papirus-icon-theme ] ++ # Icons # [ vanilla-dmz ] ++ # Cursor [ ]; @@ -60,6 +60,8 @@ in wayland.windowManager.sway = import ./programs/sway.nix { inherit scripts extra config lib pkgs terminal; }; + programs.waybar = import ./programs/waybar.nix { inherit scripts config lib pkgs terminal; }; + programs.swaylock = { enable = true; settings = { diff --git a/programs/sway.nix b/programs/sway.nix index 12cc729..e2746b7 100644 --- a/programs/sway.nix +++ b/programs/sway.nix @@ -25,9 +25,9 @@ in { scroll_factor = "0.5"; }; bars = let config = config; in [{ + command = "${pkgs.lib.getExe pkgs.waybar}"; position = "top"; inherit fonts; - statusCommand = "${pkgs.i3status}/bin/i3status"; }]; window = { border = 2; diff --git a/programs/waybar.nix b/programs/waybar.nix new file mode 100644 index 0000000..565a2b7 --- /dev/null +++ b/programs/waybar.nix @@ -0,0 +1,111 @@ +{ scripts, config, lib, pkgs, terminal, ... } : + +let + terminalExec = "${pkgs.lib.getExe terminal} -e"; +in +{ + enable = true; + settings = [{ + modules-left = [ "sway/workspaces" ]; + modules-right = [ "pulseaudio" "bluetooth" "network" "cpu" "memory" "disk" "battery" "tray" "clock" ]; + "sway/workspaces" = { + enable-bar-scroll = true; + disable-scroll-wraparound = true; + smooth-scrolling-threshold = 2.0; + }; + pulseaudio = { + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-muted = "{volume}%  {format_source}"; + format-source = "{volume}% "; + format-source-muted = "{volume}% "; + format-icons = [ "" "" ]; + on-click = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-right = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + on-click-middle = "exec pavucontrol"; + }; + network = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + on-click-right = "exec ${terminalExec} nmtui"; + }; + bluetooth = { + format = " {status}"; + format-disabled = ""; # hide module + format-connected = " {num_connections}"; + tooltip-format = "{controller_alias}\t{controller_address}"; + tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{device_enumerate}"; + tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; + on-click = "exec blueman-manager"; + on-click-right = "exec bluetoothctl disconnect"; + }; + cpu = { + format = "{usage}% "; + }; + memory = { + format = "{used:0.1f}GB/{total:0.1f}GB "; + }; + disk = { + format = "{used} "; + path = "/"; + }; + battery = { + states = { + good = 95; + warning = 20; + critical = 10; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-icons = [ "" "" "" "" "" ]; + }; + tray = { + icon-size = 20; + spacing = 5; + }; + clock = { + format = "{:%H:%M:%S %a %F}"; + tooltip-format = "{:%Y %B}\n{calendar}"; + }; + }]; + style = '' + * { + font-family: FontAwesome, Red Hat Display, sans-serif; + font-size: 12pt; + min-height: 19pt; + } + '' + + '' + window#waybar { + background: rgba(43, 48, 59, 0.9); + color: white; + } + '' + + '' + #workspaces button { + padding: 0 3px; + background: rgba(34, 34, 34, 1); + border-radius: 0; + color: white; + } + '' + + '' + #workspaces button.focused { + background: rgba(40, 85, 119, 1); + } + + .modules-right label, + .modules-right box { + border-left: 1px solid black; + padding-left: 5px; + padding-right: 5px; + } + '' + + ""; +}