waybar: moved json config to nix

This commit is contained in:
Tigor Hutasuhut 2024-10-16 11:46:19 +07:00
parent 05b77f5b34
commit db9809528d
2 changed files with 171 additions and 80 deletions

View file

@ -8,12 +8,12 @@
"on-click-middle": "close", "on-click-middle": "close",
"ignore-list": ["Alacritty"], "ignore-list": ["Alacritty"],
"app_ids-mapping": { "app_ids-mapping": {
"firefoxdeveloperedition": "firefox-developer-edition" "firefoxdeveloperedition": "firefox-developer-edition",
}, },
"rewrite": { "rewrite": {
"Firefox Web Browser": "Firefox", "Firefox Web Browser": "Firefox",
"Foot Server": "Terminal" "Foot Server": "Terminal",
} },
}, },
// Hyprland Window // Hyprland Window
"hyprland/window": { "hyprland/window": {
@ -22,26 +22,26 @@
"(.*) - Chromium": "$1", "(.*) - Chromium": "$1",
"(.*) - Brave Search": "$1", "(.*) - Brave Search": "$1",
"(.*) - Outlook": "$1", "(.*) - Outlook": "$1",
"(.*) Microsoft Teams": "$1" "(.*) Microsoft Teams": "$1",
}, },
"separate-outputs": true "separate-outputs": true,
}, },
// ML4W Welcome App // ML4W Welcome App
"custom/ml4w-welcome": { "custom/ml4w-welcome": {
"on-click": "sleep 0.1 && ~/dotfiles/eww/ml4w-sidebar/launch.sh", "on-click": "sleep 0.1 && ~/dotfiles/eww/ml4w-sidebar/launch.sh",
"on-click-right": "sleep 0.1 && ~/dotfiles/apps/ML4W_Welcome-x86_64.AppImage", "on-click-right": "sleep 0.1 && ~/dotfiles/apps/ML4W_Welcome-x86_64.AppImage",
"format": " ", "format": " ",
"tooltip": false "tooltip": false,
}, },
// ML4W Welcome App // ML4W Welcome App
"custom/ml4w-hyprland-settings": { "custom/ml4w-hyprland-settings": {
"on-click": "~/dotfiles/apps/ML4W_Hyprland_Settings-x86_64.AppImage", "on-click": "~/dotfiles/apps/ML4W_Hyprland_Settings-x86_64.AppImage",
"format": " ", "format": " ",
"tooltip": false "tooltip": false,
}, },
// Empty // Empty
"custom/empty": { "custom/empty": {
"format": "" "format": "",
}, },
// Youtube Subscriber Count // Youtube Subscriber Count
"custom/youtube": { "custom/youtube": {
@ -49,7 +49,7 @@
"exec": "python ~/private/youtube.py", "exec": "python ~/private/youtube.py",
"restart-interval": 600, "restart-interval": 600,
"on-click": "chromium https://studio.youtube.com", "on-click": "chromium https://studio.youtube.com",
"tooltip": false "tooltip": false,
}, },
// Cliphist // Cliphist
"custom/cliphist": { "custom/cliphist": {
@ -57,7 +57,7 @@
"on-click": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh", "on-click": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh",
"on-click-right": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh d", "on-click-right": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh d",
"on-click-middle": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh w", "on-click-middle": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh w",
"tooltip": false "tooltip": false,
}, },
// Updates Count // Updates Count
"custom/updates": { "custom/updates": {
@ -69,62 +69,62 @@
"restart-interval": 60, "restart-interval": 60,
"on-click": "alacritty --class dotfiles-floating -e ~/dotfiles/scripts/installupdates.sh", "on-click": "alacritty --class dotfiles-floating -e ~/dotfiles/scripts/installupdates.sh",
"on-click-right": "~/dotfiles/.settings/software.sh", "on-click-right": "~/dotfiles/.settings/software.sh",
"tooltip": false "tooltip": false,
}, },
// Wallpaper // Wallpaper
"custom/wallpaper": { "custom/wallpaper": {
"format": "", "format": "",
"on-click": "~/dotfiles/hypr/scripts/wallpaper.sh select", "on-click": "~/dotfiles/hypr/scripts/wallpaper.sh select",
"on-click-right": "~/dotfiles/hypr/scripts/wallpaper.sh", "on-click-right": "~/dotfiles/hypr/scripts/wallpaper.sh",
"tooltip": false "tooltip": false,
}, },
// Waybar Themes // Waybar Themes
"custom/waybarthemes": { "custom/waybarthemes": {
"format": "", "format": "",
"on-click": "~/dotfiles/waybar/themeswitcher.sh", "on-click": "~/dotfiles/waybar/themeswitcher.sh",
"tooltip": false "tooltip": false,
}, },
// Settings // Settings
"custom/settings": { "custom/settings": {
"format": "", "format": "",
"on-click": "~/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage", "on-click": "~/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage",
"tooltip": false "tooltip": false,
}, },
// Keybindings // Keybindings
"custom/keybindings": { "custom/keybindings": {
"format": "", "format": "",
"on-click": "~/dotfiles/hypr/scripts/keybindings.sh", "on-click": "~/dotfiles/hypr/scripts/keybindings.sh",
"tooltip": false "tooltip": false,
}, },
// Filemanager Launcher // Filemanager Launcher
"custom/filemanager": { "custom/filemanager": {
"format": "", "format": "",
"on-click": "thunar", "on-click": "thunar",
"tooltip": false "tooltip": false,
}, },
// Browser Launcher // Browser Launcher
"custom/browser": { "custom/browser": {
"format": "", "format": "",
"on-click": "microsoft-edge", "on-click": "microsoft-edge",
"tooltip": false "tooltip": false,
}, },
// ChatGPT Launcher // ChatGPT Launcher
"custom/chatgpt": { "custom/chatgpt": {
"format": "󰭹", "format": "󰭹",
"on-click": "chromium --app=https://chat.openai.com", "on-click": "chromium --app=https://chat.openai.com",
"tooltip": false "tooltip": false,
}, },
// Calculator // Calculator
"custom/calculator": { "custom/calculator": {
"format": "", "format": "",
"on-click": "qalculate-gtk", "on-click": "qalculate-gtk",
"tooltip": false "tooltip": false,
}, },
// Windows VM // Windows VM
"custom/windowsvm": { "custom/windowsvm": {
"format": "", "format": "",
"on-click": "~/dotfiles/scripts/launchvm.sh", "on-click": "~/dotfiles/scripts/launchvm.sh",
"tooltip": false "tooltip": false,
}, },
// Rofi Application Launcher // Rofi Application Launcher
"custom/appmenu": { "custom/appmenu": {
@ -133,20 +133,20 @@
// END APPS LABEL // END APPS LABEL
"on-click": "sleep 0.2;rofi -show drun -replace", "on-click": "sleep 0.2;rofi -show drun -replace",
"on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh", "on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh",
"tooltip": false "tooltip": false,
}, },
// Rofi Application Launcher // Rofi Application Launcher
"custom/appmenuicon": { "custom/appmenuicon": {
"format": "", "format": "",
"on-click": "rofi -show drun -replace", "on-click": "rofi -show drun -replace",
"on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh", "on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh",
"tooltip": false "tooltip": false,
}, },
// Power Menu // Power Menu
"custom/exit": { "custom/exit": {
"format": "", "format": "",
"on-click": "wlogout", "on-click": "wlogout",
"tooltip": false "tooltip": false,
}, },
// Keyboard State // Keyboard State
"keyboard-state": { "keyboard-state": {
@ -155,13 +155,13 @@
"format": "{name} {icon}", "format": "{name} {icon}",
"format-icons": { "format-icons": {
"locked": "", "locked": "",
"unlocked": "" "unlocked": "",
} },
}, },
// System tray // System tray
"tray": { "tray": {
"icon-size": 21, "icon-size": 21,
"spacing": 10 "spacing": 10,
}, },
// Clock // Clock
"clock": { "clock": {
@ -169,33 +169,33 @@
// "timezone": "America/New_York", // "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
// START CLOCK FORMAT // START CLOCK FORMAT
"format-alt": "{:%Y-%m-%d}" "format-alt": "{:%Y-%m-%d}",
// END CLOCK FORMAT // END CLOCK FORMAT
}, },
// System // System
"custom/system": { "custom/system": {
"format": "", "format": "",
"tooltip": false "tooltip": false,
}, },
// CPU // CPU
"cpu": { "cpu": {
"format": "/ C {usage}% ", "format": "/ C {usage}% ",
"on-click": "kitty --override confirm_os_window_close=0 btop" "on-click": "kitty --override confirm_os_window_close=0 btop",
}, },
// Memory // Memory
"memory": { "memory": {
"format": "/ M {}% ", "format": "/ M {}% ",
"on-click": "kitty --override confirm_os_window_close=0 btop" "on-click": "kitty --override confirm_os_window_close=0 btop",
}, },
// Harddisc space used // Harddisc space used
"disk": { "disk": {
"interval": 30, "interval": 30,
"format": "D {percentage_used}% ", "format": "D {percentage_used}% ",
"path": "/", "path": "/",
"on-click": "kitty --override confirm_os_window_close=0 btop" "on-click": "kitty --override confirm_os_window_close=0 btop",
}, },
"hyprland/language": { "hyprland/language": {
"format": "/ K {short}" "format": "/ K {short}",
}, },
// Group Hardware // Group Hardware
"group/hardware": { "group/hardware": {
@ -203,14 +203,14 @@
"drawer": { "drawer": {
"transition-duration": 300, "transition-duration": 300,
"children-class": "not-memory", "children-class": "not-memory",
"transition-left-to-right": false "transition-left-to-right": false,
}, },
"modules": ["custom/system", "disk", "cpu", "memory", "hyprland/language"] "modules": ["custom/system", "disk", "cpu", "memory", "hyprland/language"],
}, },
// Group Settings // Group Settings
"group/links": { "group/links": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": ["custom/chatgpt", "custom/empty"] "modules": ["custom/chatgpt", "custom/empty"],
}, },
// Group Settings // Group Settings
"group/settings": { "group/settings": {
@ -218,19 +218,19 @@
"drawer": { "drawer": {
"transition-duration": 300, "transition-duration": 300,
"children-class": "not-memory", "children-class": "not-memory",
"transition-left-to-right": false "transition-left-to-right": false,
}, },
"modules": [ "modules": [
"custom/settings", "custom/settings",
"custom/waybarthemes", "custom/waybarthemes",
"custom/wallpaper", "custom/wallpaper",
"custom/ml4w-hyprland-settings" "custom/ml4w-hyprland-settings",
] ],
}, },
// Group Quicklinks // Group Quicklinks
"group/quicklinks": { "group/quicklinks": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": ["custom/browser", "custom/filemanager", "custom/chatgpt"] "modules": ["custom/browser", "custom/filemanager", "custom/chatgpt"],
}, },
// Network // Network
"network": { "network": {
@ -243,14 +243,14 @@
"tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}", "tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}",
"tooltip-format-disconnected": "Disconnected", "tooltip-format-disconnected": "Disconnected",
"max-length": 50, "max-length": 50,
"on-click": "nm-connection-editor" "on-click": "nm-connection-editor",
}, },
// Battery // Battery
"battery": { "battery": {
"states": { "states": {
// "good": 95, // "good": 95,
"warning": 30, "warning": 30,
"critical": 15 "critical": 15,
}, },
"format": "{icon} {capacity}%", "format": "{icon} {capacity}%",
"format-charging": " {capacity}%", "format-charging": " {capacity}%",
@ -258,7 +258,7 @@
"format-alt": "{icon} {time}", "format-alt": "{icon} {time}",
// "format-good": "", // An empty format will hide the module // "format-good": "", // An empty format will hide the module
// "format-full": "", // "format-full": "",
"format-icons": [" ", " ", " ", " ", " "] "format-icons": [" ", " ", " ", " ", " "],
}, },
// Pulseaudio // Pulseaudio
"pulseaudio": { "pulseaudio": {
@ -276,9 +276,9 @@
"phone": " ", "phone": " ",
"portable": " ", "portable": " ",
"car": " ", "car": " ",
"default": [" ", " ", " "] "default": [" ", " ", " "],
}, },
"on-click": "pavucontrol" "on-click": "pavucontrol",
}, },
// Bluetooth // Bluetooth
"bluetooth": { "bluetooth": {
@ -287,13 +287,13 @@
"format-off": "", "format-off": "",
"interval": 30, "interval": 30,
"on-click": "blueman-manager", "on-click": "blueman-manager",
"format-no-controller": "" "format-no-controller": "",
}, },
// Other // Other
"user": { "user": {
"format": "{user}", "format": "{user}",
"interval": 60, "interval": 60,
"icon": false "icon": false,
}, },
// Idle Inhibator // Idle Inhibator
"idle_inhibitor": { "idle_inhibitor": {
@ -301,8 +301,8 @@
"tooltip": true, "tooltip": true,
"format-icons": { "format-icons": {
"activated": "", "activated": "",
"deactivated": "" "deactivated": "",
},
"on-click-right": "hyprlock",
}, },
"on-click-right": "hyprlock"
}
} }

View file

@ -1,18 +1,70 @@
{ lib, config, unstable, pkgs, ... }: { lib, config, unstable, pkgs, ... }:
let let
cfg = config.profile.hyprland; cfg = config.profile.hyprland;
in modules = (pkgs.formats.json { }).generate "modules.json" {
{ pulseaudio = {
config = lib.mkIf cfg.enable { format = "{icon} {volume}%";
home.packages = [ pkgs.btop ]; format-blocked = "{volume}% {icon} {format_source}";
home.file.".config/waybar/modules.jsonc".source = ./waybar-modules.jsonc; format-bluetooth-muted = " {icon} {format_source}";
home.file.".config/waybar/hyprland.jsonc".text = builtins.toJSON { format-muted = " {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = " ";
hands-free = " ";
headset = " ";
phone = " ";
portable = " ";
car = " ";
default = [ " " " " " " ];
};
on-click = "pavucontrol";
};
bluetooth = {
format = " {status}";
format-disabled = "";
format-off = "";
interval = 30;
on-click = "blueman-manager";
format-no-controller = "";
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-alt = "{icon} {time}";
format-icons = [ " " " " " " " " " " ];
};
network = {
format = "{ifname}";
format-wifi = " {signalStrength}%";
format-ethernet = " {ifname}";
format-disconnected = "Disconnected";
tooltip-format = " {ifname} via {gwaddri}";
tooltip-format-wifi = " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}";
tooltip-format-ethernet = " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}";
tooltip-format-disconnected = "Disconnected";
max-length = 50;
on-click = "nm-connection-editor";
};
"custom/cliphist" = {
format = "";
on-click = ''cliphist list | rofi -dmenu -font "$gui-font" -p "Select item to copy" -lines 10 -width 35 | cliphist decode | wl-copy'';
tooltip = false;
};
"hyprland/workspaces" = { "hyprland/workspaces" = {
"on-click" = "activate"; on-click = "activate";
"active-only" = false; active-only = false;
"all-outputs" = false; all-outputs = false;
"format" = "{icon}"; format = "{icon}";
"format-icons" = { format-icons = {
"1" = "1"; "1" = "1";
"2" = "2"; "2" = "2";
"3" = "3"; "3" = "3";
@ -24,12 +76,51 @@ in
"9" = "9"; "9" = "9";
"10" = "10"; "10" = "10";
}; };
"persistent-workspaces" = cfg.waybar.persistent-workspaces; persistent-workspaces = cfg.waybar.persistent-workspaces;
"ignore-workspaces" = [ ignore-workspaces = [
''^-'' # Ignore negatives (Scratchpads takes negavite workspace values). ''^-'' # Ignore negatives (Scratchpads takes negavite workspace values).
]; ];
}; };
idle_inhibitor = {
format = "{icon}";
tooltip = true;
format-icons = {
activated = "";
deactivated = "";
}; };
on-click-right = "hyprlock";
};
tray = {
icon-size = 21;
spacing = 10;
};
"custom/exit" = {
format = "";
on-click = "wlogout";
tooltip = false;
};
clock = {
format = "{:%H:%M %a}";
timezone = "Asia/Jakarta";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format-alt = "{:%Y-%m-%d}";
};
};
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
cliphist
wl-clipboard
rofi-wayland
];
wayland.windowManager.hyprland.settings.exec-once = [
"wl-paste --watch cliphist store"
];
programs.waybar = { programs.waybar = {
package = unstable.waybar; package = unstable.waybar;
enable = true; enable = true;
@ -44,11 +135,9 @@ in
spacing = 0; spacing = 0;
reload_style_on_change = true; reload_style_on_change = true;
include = [ include = [
"~/.config/waybar/modules.jsonc" modules
"~/.config/waybar/hyprland.jsonc"
]; ];
modules-left = [ modules-left = [
"group/quicklinks"
"hyprland/window" "hyprland/window"
]; ];
modules-center = [ modules-center = [
@ -59,7 +148,7 @@ in
"bluetooth" "bluetooth"
"battery" "battery"
"network" "network"
"group/hardware" # "group/hardware"
"custom/cliphist" "custom/cliphist"
"idle_inhibitor" "idle_inhibitor"
"tray" "tray"
@ -69,8 +158,10 @@ in
}; };
}; };
# style = '' # style = ''
# @import "${config.home.homeDirectory}/.cache/wallust/waybar.css"; # @import "${config.home.homeDirectory}/.cache/wallust/waybar.css" ;
# ''; # '';
}; };
}; };
} }