Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: HM: commit current waybar config. #194

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/hm/wayland/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
inputs,
...
}: {
imports = [./swayidle.nix];
imports = [./swayidle.nix ./waybar];
config = let
hyprland = inputs.hyprland.packages.${pkgs.system};
cfg = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
// "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": ["wlr/workspaces", "hyprland/submap", "hyprland/scratchpad", "custom/media", "hyprland/window" ],
"modules-left": ["wlr/workspaces", "hyprland/window" ],
//"modules-left": ["wlr/workspaces", "hyprland/submap", "hyprland/scratchpad", "custom/media", "hyprland/window" ],
//"modules-left": ["hyprland/workspaces", "hyprland/submap", "hyprland/scratchpad", "custom/media", "hyprland/window" ],
//"modules-center": ["hyprland/window"],
"modules-right": ["mpris", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "hyprland/language", "battery", "clock", "tray"],
"modules-right": ["mpris", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"],
// Modules configuration
"wlr/workspaces": {
// "disable-scroll": true,
Expand All @@ -20,11 +22,19 @@
// "4": "",
// "5": "",
"urgent": "",
"active": "",
"default": ""
// "active": "",
// "default": ""
},
// "persistent_workspaces": {
// "1": ["eDP-1"],
// "2": ["eDP-1"],
// "3": ["eDP-1"],
// "4": ["DP"],
// }
"on-click": "activate",
"on-click-right": "close"
"on-click-right": "close",
"on-scroll-up": "hyprctl dispatch workspace e+1",
"on-scroll-down": "hyprctl dispatch workspace e-1",

},
// "wlr/taskbar": {
Expand All @@ -40,8 +50,32 @@
"unlocked": ""
}
},
"hyprland/window": {
//"format": "{}",
"rewrite": {
"(.*) — Firefox Developer Edition Private Browsing": " $1",
"(.*) — Firefox Developer Edition": "🌎 $1",
"(.*)Firefox Developer Edition Private Browsing": "",
"(.*)Firefox Developer Edition": "",
"(.*) — Visual Studio Code": "$1 ",
"(.*)Spotify": "Spotify ",
"(.*) — zsh": "> [$1]",
"vim (.*)": " $1",
"(.*.(c|h)) - NVIM": "  $1",
"(.*.nix) - NVIM": " 󱄅 $1",
"(.*) - NVIM": " $1",
"vim": "",
"michael@nyx:(.*)": " $1",
"(.*) [—-] KeePassXC": ": $1",
"(.*) Discord (.*)": "󰙯 : $1 $2",
"nix-tree --derivation (.*)": "󱄅-󱘎 $1",
"kitty": "KITTY",
},
"separate-outputs": true,
"max-length": 200,
},
"hyprland/submap": {
"format": "<span style=\"italic\">{}</span>"
"format": "<span style=\"italic\">{:.30}</span>"
},
"hyprland/scratchpad": {
"format": "{icon} {count}",
Expand Down Expand Up @@ -93,7 +127,8 @@
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% 󰻠",
//"format": "{usage}% ",
"format": "{usage}% ",
"tooltip": false
},
"memory": {
Expand All @@ -114,7 +149,7 @@
},
"battery": {
"states": {
// "good": 95,
"good": 84,
"warning": 30,
"critical": 15
},
Expand Down Expand Up @@ -159,7 +194,7 @@
},
"mpris": {
"format": "{player} {player_icon} {dynamic}",
"format-paused": "{status_icon} <i>{dynamic}</i>",
"format-paused": "{status_icon} <i>{dynamic:.20}</i>",
"player-icons": {
"default": "▶",
"mpv": "🎵"
Expand All @@ -184,4 +219,3 @@

}


169 changes: 169 additions & 0 deletions features/hm/wayland/waybar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
pkgs,
lib,
config,
...
}: let
cfg = config;
in {
config = {
programs.waybar = {
enable = true;
package = pkgs.nw.waybar;
systemd.enable = false;
settings = {
sway = {
exclusive = true;
gtk-layer-shell = true;
layer = "top";
position = "top";
modules-left = [
"sway/workspaces"
"sway/window"
];
modules-right = [
"mpris"
"idle_inhibitor"
"pulseaudio"
"network"
"cpu"
"memory"
"temperature"
"backlight"
"battery"
"clock"
"tray"
];
"sway/window" = {
rewrite = let
# TODO: might let nvim handle this porion of the config instead.
mkEntry = regex: icon: {"(.*?\\.(${regex})) (\\+?.*?) - NVIM" = " ${icon} $1 $3";};
in {
"(.*) — Firefox Developer Edition Private Browsing" = " $1";
"(.*)Firefox Developer Edition Private Browsing" = "";
"(.*) — Firefox Developer Edition" = "🌎 $1";
"(.*)Firefox Developer Edition" = "";
"(.*) — Visual Studio Code" = "$1 ";
"(.*)Spotify" = "Spotify ";
"(.*) — zsh" = "> [$1]";
"vim (.*)" = " $1";
"vim" = "";
# "(.*) - NVIM" = " $1";
"michael@nyx:(.*)" = " $1";
"(.*) [—-] KeePassXC" = ": $1";
"(.*) Discord (.*)" = "󰙯 : $1 $2";
"nix-tree --derivation (.*)" = "󱄅-󱘎 $1";
"kitty" = "KITTY";
}
// mkEntry "c|h" ""
// mkEntry "rs" ""
// mkEntry "nix" "󱄅"
// mkEntry "go" ""
// mkEntry "css" ""
// mkEntry "html" ""
// mkEntry "js" ""
// mkEntry "pl" ""
// mkEntry "rb" ""
// mkEntry "exs|ex" ""
// mkEntry "lua" "󰢱"
// mkEntry "yaml|yml|md" ""
// mkEntry "py" ""
// mkEntry "sh|zsh" ""
// mkEntry "Dockerfile|compose|docker-compose" ""
// mkEntry "java" ""
// mkEntry "diff|patch|gitrebase" ""
// mkEntry "json" ""
// mkEntry "xml" "󰗀"
;
seperate-outputs = true;
max-length = 200;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
"activated" = "";
"deactivated" = "";
};
};
tray = {
spacing = 10;
};
clock = {
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
"format-alt" = "{:%Y-%m-%d}";
};
cpu = {
"format" = "{usage}% 󰻠";
"tooltip" = false;
};
memory = {
format = "{}% ";
};
temperature = {
# TODO: make this generic
hwmon-path = "/sys/class/hwmon/hwmon5/temp1_input";
critical-threshold = 80;
format = "{temperatureC}°C";
format-icons = ["" "" ""];
};
backlight = {
device = "acpi_video1";
format = "{percent}% {icon}";
format-icons = ["" "" "" "" "" "" "" "" ""];
};
battery = {
states = {
good = 84;
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
format-alt = "{time} {icon}";
format-icons = ["" "" "" "" ""];
};
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}";
};
pulseaudio = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "x {icon} {format_source}";
format-muted = "x {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
"on-click" = "pavucontrol";
};
mpris = {
format = "{player} {player_icon} {dynamic}";
format-paused = "{status_icon} <i>{dynamic:.20}</i>";
player-icons = {
default = "▶";
mpv = "🎵";
};
status-icons = {
"paused" = "⏸";
};
ignored-players = ["firefox"];
};
};
};
style = builtins.readFile ./style.css;
};
};
}
11 changes: 8 additions & 3 deletions features/hm/wayland/waybar/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
/* font-family: "Symbols Nerd Font",FontAwesome, Roboto, Helvetica, Arial, sans-serif; */
font-family: "JetBrainsMono Nerd Font";
font-size: 11px;
}

window#waybar {
Expand Down Expand Up @@ -62,6 +63,10 @@ button:hover {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.active {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}

#workspaces button.urgent {
background-color: #eb4d4b;
Expand Down Expand Up @@ -276,5 +281,5 @@ label:focus {
}

#scratchpad.empty {
background-color: transparent;
background-color: transparent;
}
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@
electron-mail-latest =
prev.callPackage ./pkgs/electron-mail {};
inherit (inputs.slh.legacyPackages.${prev.system}) systemd-lock-handler;
nw = let
nw-pkgs = inputs.nixpkgs-wayland.packages.${prev.system};
in
nw-pkgs
// {
};
})
];
})
Expand Down