diff --git a/dots/waybar/config.jsonc b/dots/waybar/config.jsonc new file mode 100644 index 0000000..4fa70cb --- /dev/null +++ b/dots/waybar/config.jsonc @@ -0,0 +1,253 @@ +// Waybar config for niri +// Place at: ~/.config/waybar/config.jsonc +// Requires: niri >= 0.1.9 for niri/workspaces, niri/window, niri/language + +{ + // ── Bar geometry ────────────────────────────────────────── + "layer": "top", + "position": "top", + "mod": "dock", + "exclusive": true, + "passthrough": false, + "gtk-layer-shell": true, + "height": 36, + "margin-right": 5, + "margin-left": 5, + + // ── Module layout ───────────────────────────────────────── + "modules-left": [ + "custom/fuzzel", + "custom/weather", + "custom/khorshididate", + "custom/clock", + "wlr/taskbar" + ], + + "modules-center": [ + "niri/workspaces" + ], + + "modules-right": [ + "tray", + "battery", + "wireplumber", + "wireplumber#source", + "backlight", + "cpu", + "memory", + "disk", + "temperature", + "custom/updates", + "network", + "niri/language", + "custom/lock_screen", + "custom/power" + ], + + // ── Left modules ────────────────────────────────────────── + + "custom/fuzzel": { + "format": "  ", + "on-click": "fuzzel", + "tooltip": false + }, + + "custom/weather": { + // Shows current weather and forecast via wttr.in + "tooltip": true, + "format": "{}", + "interval": 3600, + "exec": "~/.config/waybar/scripts/wttr.py", + "return-type": "json" + }, + + "custom/khorshididate": { + // Persian (Jalali/Shamsi) calendar date + "tooltip": true, + "format": " {}", + "format-alt": " {alt}", + "format-alt-click": "click-right", + "interval": 3600, + "exec": "~/.config/waybar/scripts/khorshidi-date", + "return-type": "json" + }, + + "custom/clock": { + "exec": "~/.config/waybar/scripts/clock-tooltip", + "return-type": "json", + "interval": 60, + "tooltip": true, + "on-click": "setbg" + }, + + "wlr/taskbar": { + // Works with niri via standard Wayland foreign-toplevel protocol + "format": "{icon}", + "icon-size": 12, + "all-outputs": true, + "tooltip-format": "{name}: {title}", + "on-click": "activate", + "on-click-middle": "close", + "ignore-list": [ + "rofi" + ] + }, + + // ── Center modules ──────────────────────────────────────── + + "niri/workspaces": { + // Dynamic workspaces — only browser and obs are named/persistent. + // Shows dynamic workspace indices plus named workspaces by name. + "all-outputs": true, + "format": "{value}" + }, + + // ── Right modules ───────────────────────────────────────── + + "tray": { + "icon-size": 12, + "spacing": 10 + }, + + "battery": { + "format": "{icon}", + "format-icons": { + "default": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"], + "charging": ["󰢟", "󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], + "plugged": "" + }, + "format-alt-click": "click-right", + "format-alt": "{icon} {capacity}%", + "states": { + "good": 95, + "warning": 20, + "critical": 10 + } + }, + + "wireplumber": { + "format": " {icon} ", + "format-muted": "  ", + "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", + "on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+", + "on-scroll-down": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-", + "scroll-step": 5, + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "tooltip": true, + "tooltip-format": "{icon} at {volume}%" + }, + + "wireplumber#source": { + "format": " {format_source}", + "format-source": "", + "format-source-muted": "", + "on-click": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle", + "on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SOURCE@ 5%+", + "on-scroll-down": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SOURCE@ 5%-", + "scroll-step": 5, + "tooltip": true, + "tooltip-format": " at {volume}%" + }, + + "backlight": { + "device": "intel_backlight", + "format": "{icon}", + "format-alt-click": "click-right", + "format-alt": "{icon} {percent}%", + "format-icons": ["󰃞", "󰃟", "󰃠"], + "on-scroll-up": "brightness -i", + "on-scroll-down": "brightness -d" + }, + + "cpu": { + "interval": 10, + "format": "", + "max-length": 10, + "format-alt-click": "click-right", + "format-alt": " {usage}%" + }, + + "memory": { + "interval": 30, + "format": "", + "format-alt-click": "click-right", + "format-alt": " {}%", + "max-length": 10, + "tooltip": true, + "tooltip-format": "Memory - {used:0.1f}GB used" + }, + + "disk": { + "interval": 600, + "format": "󰋊", + "path": "/", + "format-alt-click": "click-right", + "format-alt": "󰋊 {percentage_used}%", + "tooltip": true, + "tooltip-format": "HDD - {used} used out of {total} on {path} ({percentage_used}%)", + "states": { + "warning": 85, + "critical": 90 + } + }, + + "temperature": { + "thermal-zone": 1, + "format": "", + "format-alt-click": "click-right", + "format-alt": " {temperatureC}°C", + "critical-threshold": 70, + "format-critical": " {temperatureC}°C" + }, + + "custom/updates": { + // Send signal 8 to waybar after running updates to refresh: killall -SIGUSR1 waybar + "format": "{}", + "exec": "~/.config/waybar/scripts/update-sys", + "on-click": "~/.config/waybar/scripts/update-sys update", + "interval": 3600, + "tooltip": true, + "signal": 8, + "return-type": "json" + }, + + "network": { + "format": "{ifname}", + + "format-wifi": " ", + "format-ethernet": " ", + "format-disconnected": " ", //An empty format will hide the module. + "tooltip-format": " {ifname} via {gwaddr}", + "tooltip-format-wifi": " {essid} ({signalStrength}%)", + "tooltip-format-ethernet": " {ifname} {ipaddr}/{cidr}", + "tooltip-format-disconnected": "Disconnected", + "max-length": 50 + }, + + "niri/language": { + // niri reports the layout name from xkb; map display labels here + "format": "󰛓 {}", + "format-en": "EN", + "format-": "FA" + }, + + "custom/lock_screen": { + "format": "", + "on-click": "sh -c '(sleep 0.5s; swaylock -eFfki ~/Pictures/lockscreen.png)' & disown", + "tooltip": false + }, + + "custom/power": { + "format": " ", + "on-click": "sysact", + "tooltip": false + } +} diff --git a/dots/waybar/readme.md b/dots/waybar/readme.md new file mode 100644 index 0000000..bc15c1b --- /dev/null +++ b/dots/waybar/readme.md @@ -0,0 +1,5 @@ +overview: +https://github.com/Alexays/Waybar/wiki/Examples + +in use: +https://github.com/mhdzli/dotfiles/tree/home/.config/waybar diff --git a/dots/waybar/style.css b/dots/waybar/style.css new file mode 100644 index 0000000..8b88c07 --- /dev/null +++ b/dots/waybar/style.css @@ -0,0 +1,225 @@ +/* Colors (dracula) */ +@define-color foreground #f8f8f2; +@define-color background rgba(40, 42, 54, 0.5); +@define-color orange #ffb86c; +@define-color gray #44475a; +@define-color black #21222c; +@define-color red #ff5555; +@define-color green #50fa7b; +@define-color yellow #f1fa8c; +@define-color cyan #8be9fd; +@define-color blue #6272a4; +@define-color purple #bd93f9; +@define-color pink #ff79c6; +@define-color white #ffffff; +@define-color brred #ff6e6e; +@define-color brgreen #69ff94; +@define-color bryellow #ffffa5; +@define-color brcyan #a4ffff; +@define-color brblue #6272a4; +@define-color brpurple #d6acff; +@define-color brpink #ff92df; + +@define-color arch_blue #89b4fa; + +@define-color workspace_background @background; +@define-color workspace_button @foreground; +@define-color workspace_active @black; +@define-color workspace_active_background @green; +@define-color workspace_urgent @white; +@define-color workspace_urgent_background @brred; +@define-color workspace_hover @black; +@define-color workspace_hover_background @pink; +@define-color critical @red; +@define-color warning @yellow; + + +@keyframes blink { + to { + background-color: @white; + color: @black; + } +} + +* { + border: none; + border-radius: 0; + font-family: "monospace"; + font-weight: bold; + font-size: 16px; + min-height: 0; +} + +window#waybar { + background: transparent; + color: @foreground; +} + +#workspaces { + background: @workspace_background; + opacity: 1; + transition: none; + padding: 5px 5px; + border-radius: 5px; +} + +/* ── niri/workspaces button states ────────────────────────────────────── + .empty = exists but no windows (named workspaces never disappear) + .active = visible on this output but not keyboard-focused + .focused = the workspace currently receiving input + .urgent = has a window requesting attention + ───────────────────────────────────────────────────────────────────── */ + +#workspaces button, +#workspaces button.empty { + background: transparent; + color: @blue; + border-radius: 5px; + padding: 0 6px; + min-width: 18px; + transition: none; +} + +#workspaces button.active { + background: transparent; + color: @purple; + border-bottom: 2px solid @purple; + border-radius: 5px 5px 0 0; +} + +#workspaces button.focused { + background: @workspace_active_background; + color: @workspace_active; + border-radius: 5px; + border-bottom: 2px solid @pink; +} + +#workspaces button.urgent { + background: @workspace_urgent_background; + color: @workspace_urgent; + border-radius: 5px; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#workspaces button:hover { + background: @workspace_hover_background; + color: @workspace_hover; + border-radius: 5px; +} + +#workspaces button:not(.current_output) { + opacity: 0.5; +} + +#taskbar { + background: @background; + border-radius: 5px; + margin: 5px 10px 5px 50px; +} + +tooltip { + background: @background; + opacity: 0.95; + border-radius: 10px; + border-width: 2px; + border-style: solid; + border-color: @purple; +} + +tooltip label { + color: @foreground; +} + +#custom-fuzzel, +#custom-lock_screen, +#custom-power, +#custom-weather, +#custom-khorshididate, +#cpu, +#disk, +#custom-updates, +#memory, +#clock, +#custom-clock, +#battery, +#pulseaudio, +#network, +#tray, +#temperature, +#backlight, +#language { + background: @background; + opacity: 1; + padding: 0px 5px; + margin: 2px 0px 2px 0px; +} + +#disk.critical, +#temperature.critical { + background-color: @critical; +} + +#disk.warning, +#temperature.warning { + background-color: @warning; +} + +#battery { + color: @green; + border-radius: 5px 0px 0px 5px; +} + +#battery.discharging { + color: @foreground; +} + +#battery.warning:not(.charging) { + background: @warning; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#battery.critical:not(.charging) { + background-color: @critical; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#custom-fuzzel { + color: @arch_blue; + border-radius: 5px 0px 0px 5px; +} + +#custom-power { + color: @red; + border-radius: 0px 5px 5px 0px; +} + +#clock, +#custom-clock { + border-radius: 0px 5px 5px 0px; +} + +#tray { + background: @background; + border-radius: 5px; + margin: 5px 50px 5px 10px; +} + +#wireplumber { + background: @background; +} + +#wireplumber.source { + background: @background; +} diff --git a/scripts/99_deploy.sh b/scripts/99_deploy.sh index eec8d11..14dc242 100755 --- a/scripts/99_deploy.sh +++ b/scripts/99_deploy.sh @@ -306,6 +306,11 @@ if [ ${operation} == "dots" ] ; then create_dir ${file_path} deploy_file "${dots_trg}/hyprmon/*" "${file_path}/" + # waybar + file_path=/home/${system_user}/.config/waybar + create_dir ${file_path} + deploy_file "${dots_trg}/waybar/*" "${file_path}/" + # ---------- # printing #