From cc215acf4d2f5a8f30978b9538114ba435333767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20P=C3=A1rk=C3=A1nyi?= Date: Fri, 7 Aug 2026 00:03:57 +0200 Subject: [PATCH] feat(waybar): two configs for desktop and laptop --- .gitignore | 12 ++ fedora.sh | 28 +++- rofi/applets/bin/ppd.sh | 77 +++++++++ waybar/{config => config_desktop.json} | 2 +- waybar/config_laptop.json | 19 +++ waybar/modules.jsonc | 222 +++++++++++++------------ waybar/style.css | 202 +++++++++++----------- 7 files changed, 341 insertions(+), 221 deletions(-) create mode 100644 .gitignore create mode 100755 rofi/applets/bin/ppd.sh rename waybar/{config => config_desktop.json} (96%) create mode 100644 waybar/config_laptop.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fcaefe4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +zsh/.zcompdump* +FiraCode.zip +systemd/user/default.target.wants/* +systemd/user/graphical-session.target.wants/* +systemd/user/sockets.target.wants/* +nvim/lazy-lock.json +gtk-4.0/servers +pulse/cookie +kdeconnect +dconf +pavucontrol.ini +waybar/config diff --git a/fedora.sh b/fedora.sh index 0e573a5..eb8bc17 100755 --- a/fedora.sh +++ b/fedora.sh @@ -15,14 +15,6 @@ set_unit () { systemctl --user enable --now $* } -replace_config_line "/etc/dnf/dnf.conf" "installonly_limit" "3" -replace_config_line "/etc/dnf/dnf.conf" "best" "False" -replace_config_line "/etc/dnf/dnf.conf" "skip_unavailable" "True" -replace_config_line "/etc/dnf/dnf.conf" "fastestmirror" "True" -replace_config_line "/etc/dnf/dnf.conf" "defaultyes" "True" -replace_config_line "/etc/dnf/dnf.conf" "keepcache" "True" -replace_config_line "/etc/dnf/dnf.conf" "max_parallel_downloads" "10" - ensure_installed () { for dep in $*; do if $(dnf list --installed "$dep" 2>&1 | grep -q "$dep") ; then @@ -33,6 +25,18 @@ ensure_installed () { done } +# Select install type + +type="${1:-desktop}" + +replace_config_line "/etc/dnf/dnf.conf" "installonly_limit" "3" +replace_config_line "/etc/dnf/dnf.conf" "best" "False" +replace_config_line "/etc/dnf/dnf.conf" "skip_unavailable" "True" +replace_config_line "/etc/dnf/dnf.conf" "fastestmirror" "True" +replace_config_line "/etc/dnf/dnf.conf" "defaultyes" "True" +replace_config_line "/etc/dnf/dnf.conf" "keepcache" "True" +replace_config_line "/etc/dnf/dnf.conf" "max_parallel_downloads" "10" + # Enable extra repos sudo dnf update sudo dnf copr enable lionheartp/Hyprland @@ -65,10 +69,16 @@ mkdir -p ~/.local/share/backgrounds/ curl -o ~/.local/share/backgrounds/eKxlw8.jpg -fsSL "https://live.staticflickr.com/5077/5914101671_d80c6591e8_k.jpg" set_unit hypridle.service hyprpaper.service hyprpolkitagent.service hyprsunset.service set_unit pipewire.service pipewire-pulse.service + # desktop elements that just work ensure_installed swaync set_unit swaync.service -ensure_installed waybar fontawesome4-fonts +ensure_installed waybar fontawesome4-fonts pavucontrol powerprofilesctl blueman +if [ "$type" = "laptop" ]; then + cp ~/.config/waybar/config_laptop.json ~/.config/waybar/config +else + cp ~/.config/waybar/config_desktop.json ~/.config/waybar/config +fi set_unit waybar.service ensure_installed cliphist set_unit cliphist.service diff --git a/rofi/applets/bin/ppd.sh b/rofi/applets/bin/ppd.sh new file mode 100755 index 0000000..80276c7 --- /dev/null +++ b/rofi/applets/bin/ppd.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +## Author : Aditya Shakya (adi1090x) +## Github : @adi1090x +# +## Applets : Power Menu + +# Import Current Theme +source "$HOME"/.config/rofi/applets/shared/theme.bash +theme="$type/$style" + +# Theme Elements +prompt="Select power profile" +mesg="Current power profile : `powerprofilesctl get`" + +if [[ ( "$theme" == *'type-1'* ) || ( "$theme" == *'type-3'* ) || ( "$theme" == *'type-5'* ) ]]; then + list_col='1' + list_row='3' +elif [[ ( "$theme" == *'type-2'* ) || ( "$theme" == *'type-4'* ) ]]; then + list_col='3' + list_row='1' +fi + +# Options +layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2` +if [ "$layout" = 'NO' ]; then + option_1="󰡴 Performance" + option_2="󰊚 Balanced" + option_3="󰡳 Power saver" +else + option_1="󰡴" + option_2="󰊚" + option_3="󰡳" +fi + +# Rofi CMD +rofi_cmd() { + rofi -theme-str "listview {columns: $list_col; lines: $list_row;}" \ + -theme-str 'textbox-prompt-colon {str: "";}' \ + -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${theme} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3" | rofi_cmd +} + + +# Execute Command +run_cmd() { + if [ "$1" = '--opt1' ]; then + powerprofilesctl set performance + elif [ "$1" = '--opt2' ]; then + powerprofilesctl set balanced + elif [ "$1" = '--opt3' ]; then + powerprofilesctl set power-saver + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; +esac + diff --git a/waybar/config b/waybar/config_desktop.json similarity index 96% rename from waybar/config rename to waybar/config_desktop.json index f71abe2..eafb5cc 100644 --- a/waybar/config +++ b/waybar/config_desktop.json @@ -4,7 +4,7 @@ "include": [ "~/.config/waybar/modules.jsonc" ], - "height": 40, + "height": 40, "margin-left": 3, "margin-right": 3, "margin-top": 3, diff --git a/waybar/config_laptop.json b/waybar/config_laptop.json new file mode 100644 index 0000000..b3d7814 --- /dev/null +++ b/waybar/config_laptop.json @@ -0,0 +1,19 @@ +{ + "layer": "top", + "position": "top", + "include": [ + "~/.config/waybar/modules.jsonc" + ], + "height": 20, + "margin-left": 3, + "margin-right": 3, + "margin-top": 3, + "margin-bottom": 3, + "modules-left": ["custom/junkyard", "hyprland/workspaces"], + "modules-center": ["clock"], + "modules-right": ["tray", "custom/notification", "pulseaudio", "bluetooth", "backlight", "network", "battery", "group/group-power" ], + "tray": { + "icon-size": 16, + "spacing": 10 + }, +} diff --git a/waybar/modules.jsonc b/waybar/modules.jsonc index 832535d..53937c8 100755 --- a/waybar/modules.jsonc +++ b/waybar/modules.jsonc @@ -20,39 +20,39 @@ // "timezone": "America/New_York", "tooltip-format": "{:%Y %B}\n{calendar}", "format": "{:%a, %d %b, %R}", - "on-click": "" + "on-click": "" }, "pulseaudio": { // "scroll-step": 1, // %, can be a float //"reverse-scrolling": 1, "format": "{icon} {volume}% {format_source}", - "format-bluetooth": "{icon}  {volume}% {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": "婢 {format_source}", + "format-bluetooth": "{icon} {volume}% {format_source}", + "format-bluetooth-muted": "{icon} {format_source}", + "format-muted": "󰝟 {volume}% {format_source}", "format-source": " {volume}%", "format-source-muted": "", "format-icons": { "headphone": "󰋋", - "hands-free": "", + "hands-free": "󱡒", "headset": "󰋎", "phone": "", - "portable": "", + "portable": "󰓃", "car": "", "default": ["󰸈", "󰕿", "󰖀", "󰕾"] }, - "on-click": "~/.config/rofi/applets/bin/volume.sh", + "on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle", "on-click-right": "uwsm app pavucontrol" }, - "bluetooth": { - "format": "", - "format-disabled": "", - "format-connected": " {num_connections}", - "tooltip-format-enumerate-connected": "{device_alias}", - "tooltip-format-connected": "{device_enumerate}", - "on-click": "uwsm app blueman-manager" - }, + "bluetooth": { + "format": "", + "format-disabled": "", + "format-connected": " {num_connections}", + "tooltip-format-enumerate-connected": "{device_alias}", + "tooltip-format-connected": "{device_enumerate}", + "on-click": "uwsm app blueman-manager" + }, "temperature": { // "thermal-zone": 2, @@ -66,6 +66,7 @@ "tray": { "icon-size": 13, + "show-passive-items": true, "spacing": 00 }, @@ -73,14 +74,14 @@ "tooltip": false, "format": "{icon}", "format-icons": { - "notification": "", - "none": "", - "dnd-notification": "", - "dnd-none": "", - "inhibited-notification": "", - "inhibited-none": "", - "dnd-inhibited-notification": "", - "dnd-inhibited-none": "" + "notification": "", + "none": "", + "dnd-notification": "", + "dnd-none": "", + "inhibited-notification": "", + "inhibited-none": "", + "dnd-inhibited-notification": "", + "dnd-inhibited-none": "" }, "return-type": "json", "exec-if": "which swaync-client", @@ -91,94 +92,99 @@ "escape": true }, - "cpu": { - "interval": 1, - "format": " {usage:02d}%{icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}", - "format-icons": [ - "", // green - "", // blue - "", // white - "", // white - "", // yellow - "", // yellow - "", // orange - "" // red - ] - }, + "cpu": { + "interval": 1, + "format": " {usage:02d}%{icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}", + "format-icons": [ + "", // green + "", // blue + "", // white + "", // white + "", // yellow + "", // yellow + "", // orange + "" // red + ] + }, - "memory": { - "interval": 5, - "format": "󰍛 {percentage}%" - }, + "memory": { + "interval": 5, + "format": "󰍛 {percentage}%" + }, - "group/group-power": { - "orientation": "inherit", - "drawer": { - "transition-duration": 500, - "children-class": "not-power", - "transition-left-to-right": true - }, - "modules": [ - "custom/power", // First element is the "group leader" and won't ever be hidden - "custom/reboot", - "custom/quit", - "custom/suspend", - "custom/lock" - ] - }, - "custom/quit": { - "format": " 󰗼 ", + "group/group-power": { + "orientation": "inherit", + "drawer": { + "transition-duration": 500, + "children-class": "not-power", + "transition-left-to-right": true + }, + "modules": [ + "custom/power", // First element is the "group leader" and won't ever be hidden + "custom/reboot", + "custom/quit", + "custom/suspend", + "custom/lock" + ] + }, + "custom/quit": { + "format": " 󰗼 ", + "tooltip": false, + "on-click": "uwsm stop" + }, + "custom/lock": { + "format": " 󰍁 ", + "tooltip": false, + "on-click": "loginctl lock-session" + }, + "custom/suspend": { + "format": " 󰒲 ", "tooltip": false, - "on-click": "uwsm stop" - }, - "custom/lock": { - "format": " 󰍁 ", - "tooltip": false, - "on-click": "loginctl lock-session" - }, - "custom/suspend": { - "format": " 󰒲 ", - "tooltip": false, - "on-click": "systemctl suspend" - }, - "custom/reboot": { - "format": " 󰜉 ", - "tooltip": false, - "on-click": "systemctl reboot" - }, - "custom/power": { - "format": "  ", - "tooltip": false, - "on-click": "systemctl poweroff" - }, + "on-click": "systemctl suspend" + }, + "custom/reboot": { + "format": " 󰜉 ", + "tooltip": false, + "on-click": "systemctl reboot" + }, + "custom/power": { + "format": "  ", + "tooltip": false, + "on-click": "systemctl poweroff" + }, - "battery": { - "states": { - "warning": 20, - "critical": 5 - }, - "format": "{capacity}% {icon}", - "format-charging": "{capacity}% 󰂄", - "format-plugged": "{capacity}% 󰚥", - "format-alt": "{time} {icon}", - "format-icons": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂁", "󰁹"], - "on-click": "~/.config/rofi/applets/bin/powermenu.sh" - }, - "battery#bat0": { - "bat": "BAT0" - }, + "battery": { + "states": { + "warning": 20, + "critical": 5 + }, + "format": "{icon}{capacity}%", + "format-charging": "{capacity}% 󰂄", + "format-plugged": "{capacity}% 󰚥", + // "format-alt": "{time} {icon}", + "format-icons": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂁", "󰁹"], + "on-click": "~/.config/rofi/applets/bin/ppd.sh" + }, + "battery#bat0": { + "bat": "BAT0" + }, - "network": { - "format-wifi": "{icon}", - "format-ethernet": "󰈀", - "format-linked": "󰤩", - "format-disconnected": "󰤮", - "tooltip-format": "{ifname}", - "tooltip-format-wifi": "{essid} {signaldBm}dBm | Downlink: {bandwidthDownBits}, Uplink: {bandwidthUpBits}", - "tooltip-format-ethernet": "{essid} | Downlink: {bandwidthDownBits}, Uplink: {bandwidthUpBits} | IP: {ipaddr} GW:{gwaddr}", - "tooltip-format-disconnected": "Disconnected", - "format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], - "on-click": "~/.config/rofi/applets/bin/rofi-wifi-menu.sh", - "on-click-right": "nm-connection-editor" - } + "backlight": { + "format": "{icon} {percent}%", + "format-icons": ["󰃞", "󰃟", "󰃠"] + }, + + "network": { + "format-wifi": "{icon}", + "format-ethernet": "󰈀", + "format-linked": "󰤩", + "format-disconnected": "󰤮", + "tooltip-format": "{ifname}", + "tooltip-format-wifi": "{essid} {signaldBm}dBm | Downlink: {bandwidthDownBits}, Uplink: {bandwidthUpBits}", + "tooltip-format-ethernet": "{essid} | Downlink: {bandwidthDownBits}, Uplink: {bandwidthUpBits} | IP: {ipaddr} GW:{gwaddr}", + "tooltip-format-disconnected": "Disconnected", + "format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], + "on-click": "~/.config/rofi/applets/bin/rofi-wifi-menu.sh", + "on-click-right": "nm-connection-editor" + } } diff --git a/waybar/style.css b/waybar/style.css index 1ccd686..d20e735 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -1,158 +1,154 @@ @import 'macchiato.css'; * { - font-family: "Roboto"; - font-size: 16px; - min-width: 15px; + font-family: "Roboto"; + font-size: 16px; + min-width: 15px; } window#waybar { - background-color: transparent; + background-color: transparent; } window#waybar.hidden { - opacity: 0.5; + opacity: 0.5; } button { - box-shadow: inset 0 -3px transparent; - border: none; - border-radius: 10px; - color: @text; + box-shadow: inset 0 -3px transparent; + border: none; + border-radius: 10px; + color: @text; } +#workspaces { + background-color: @base; /* Change this to any gray color you want */ + border-radius: 0px 10px 10px 0px; /* Adjust as needed */ + padding: 3px 10px; + color: @text; +} + #workspaces button.active { - background-color: @blue; - border: 1px solid @blue; - border-radius: 10px; - color: @base; + background-color: @blue; + /* border: 1px solid @blue; */ + border-radius: 10px; + color: @base; +} + +#workspaces button:hover { + background: @crust; + color: @text; + border-radius: 10px; } #workspaces button.urgent { - background-color: @red; - border: 1px solid @red; - border-radius: 10px; - color: @base; + background-color: @red; + border: 1px solid @red; + border-radius: 10px; + color: @base; } -#clock, -#battery{ - background-color: @base; /* Change this to any gray color you want */ - border-radius: 10px; /* Adjust as needed */ - padding: 3px 10px; - color: @text; +#clock { + background-color: @base; /* Change this to any gray color you want */ + border-radius: 10px; /* Adjust as needed */ + padding: 3px 10px; + color: @text; } #mpd { - padding: 0 10px; - color: @subtext1; + padding: 0 10px; + color: @subtext1; } #tray { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 10px 0px 0px 10px; /* Adjust as needed */ - padding: 3px 10px; - color: @text; + background-color: @base; /* Change this to any gray color you want */ + border-radius: 10px 0px 0px 10px; /* Adjust as needed */ + padding: 3px 10px; + color: @text; } #custom-notification, #pulseaudio, #network, #memory, +#backlight, #bluetooth { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 0px; /* Adjust as needed */ - padding: 3px 7px; - color: @text; - margin: 0px; + background-color: @base; /* Change this to any gray color you want */ + border-radius: 0px; /* Adjust as needed */ + padding: 3px 3px; + color: @text; + margin: 0px; } -#cpu { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 0px 10px 10px 0px; /* Adjust as needed */ - padding: 3px 10px; - color: @text; - min-width: 80px; +#pulseaudio { + min-width: 110px } - #backlight { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 0px 10px 10px 0px; /* Adjust as needed */ - padding: 3px 10px; - color: @text; -} - -#custom-junkyard { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 10px 0px 0px 10px; /* Adjust as needed */ - padding: 3px 10px; - color: @text; -} - -#workspaces { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 0px 10px 10px 0px; /* Adjust as needed */ - padding: 3px 10px; - color: @text; -} - - -#clock { - background-color: @base; /* Change this to any gray color you want */ - border-radius: 10px; - padding: 3px 10px; - color: @text; -} - -#group-power { - background-color: @base; - border-radius: 10px; - padding: 3px 5px; - margin-left: 3px; - color: @text; + min-width: 60px } +#cpu, #battery { - background-color: @base; /* Change this to any gray color you want */ - color: @text; - margin-left: 7px; + background-color: @base; /* Change this to any gray color you want */ + border-radius: 0px 10px 10px 0px; /* Adjust as needed */ + padding: 3px 10px; + color: @text; } -#battery.charging, #battery.plugged { - color: @base; - background-color: @teal; - border-radius: 10px; - padding: 3px 10px; -} - -@keyframes blink { - to { - background-color: @subtext1; - color: @crust; - } +#battery.charging, +#battery.plugged { + color: @base; + background-color: @teal; } #battery.critical:not(.charging) { - background-color: @red; - color: @subtext1; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - border-radius: 10px; - padding: 3px 10px; + background-color: @red; + color: @subtext1; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#custom-junkyard { + background-color: @base; /* Change this to any gray color you want */ + border-radius: 10px 0px 0px 10px; /* Adjust as needed */ + padding: 3px 10px; + color: @text; +} + +#clock { + background-color: @base; /* Change this to any gray color you want */ + border-radius: 10px; + padding: 3px 10px; + color: @text; +} + +#group-power { + background-color: @base; + border-radius: 10px; + padding: 3px 5px; + margin-left: 3px; + color: @text; +} + +@keyframes blink { + to { + background-color: @subtext1; + color: @crust; + } } label:focus { - background-color: @crust; + background-color: @crust; } #tray > .passive { - -gtk-icon-effect: dim; + -gtk-icon-effect: dim; } #tray > .needs-attention { - -gtk-icon-effect: highlight; - background-color: @red; + -gtk-icon-effect: highlight; + background-color: @red; }