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

View file

@ -1,35 +1,126 @@
{ lib, config, unstable, pkgs, ... }:
let
cfg = config.profile.hyprland;
modules = (pkgs.formats.json { }).generate "modules.json" {
pulseaudio = {
format = "{icon} {volume}%";
format-blocked = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
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" = {
on-click = "activate";
active-only = false;
all-outputs = false;
format = "{icon}";
format-icons = {
"1" = "1";
"2" = "2";
"3" = "3";
"4" = "4";
"5" = " 5";
"6" = " 6";
"7" = "󰙯 7";
"8" = "8";
"9" = "9";
"10" = "10";
};
persistent-workspaces = cfg.waybar.persistent-workspaces;
ignore-workspaces = [
''^-'' # 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 = [ pkgs.btop ];
home.file.".config/waybar/modules.jsonc".source = ./waybar-modules.jsonc;
home.file.".config/waybar/hyprland.jsonc".text = builtins.toJSON {
"hyprland/workspaces" = {
"on-click" = "activate";
"active-only" = false;
"all-outputs" = false;
"format" = "{icon}";
"format-icons" = {
"1" = "1";
"2" = "2";
"3" = "3";
"4" = "4";
"5" = " 5";
"6" = " 6";
"7" = "󰙯 7";
"8" = "8";
"9" = "9";
"10" = "10";
};
"persistent-workspaces" = cfg.waybar.persistent-workspaces;
"ignore-workspaces" = [
''^-'' # Ignore negatives (Scratchpads takes negavite workspace values).
];
};
};
home.packages = with pkgs; [
cliphist
wl-clipboard
rofi-wayland
];
wayland.windowManager.hyprland.settings.exec-once = [
"wl-paste --watch cliphist store"
];
programs.waybar = {
package = unstable.waybar;
enable = true;
@ -44,11 +135,9 @@ in
spacing = 0;
reload_style_on_change = true;
include = [
"~/.config/waybar/modules.jsonc"
"~/.config/waybar/hyprland.jsonc"
modules
];
modules-left = [
"group/quicklinks"
"hyprland/window"
];
modules-center = [
@ -59,7 +148,7 @@ in
"bluetooth"
"battery"
"network"
"group/hardware"
# "group/hardware"
"custom/cliphist"
"idle_inhibitor"
"tray"
@ -69,8 +158,10 @@ in
};
};
# style = ''
# @import "${config.home.homeDirectory}/.cache/wallust/waybar.css";
# @import "${config.home.homeDirectory}/.cache/wallust/waybar.css" ;
# '';
};
};
}