From f6ecbb82f4f518f7dd6983935211412e4ea2955e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 11 Nov 2025 19:53:35 +0300 Subject: [PATCH] feat: :sparkles: eww config, hyprlock --- .config/btop/btop.conf | 2 +- .config/eww/eww.css | 190 ++++++++++++++++++- .config/eww/eww.yuck | 295 ++++++++++++++++++++++++++---- .config/fish/conf.d/rustup.fish | 1 + .config/hypr/hyprland.conf | 34 ++-- .config/hypr/hyprlock.conf | 66 +++++++ .config/hypr/hyprpaper.conf | 2 +- .config/qt6ct/qt6ct.conf | 2 +- .config/scripts/battery_info.sh | 87 +++++++++ .config/scripts/cpu_status.sh | 210 +++++++++++++++++++++ .config/scripts/datetime_info.sh | 33 ++++ .config/scripts/memory_status.sh | 112 ++++++++++++ .config/scripts/network_speed.sh | 59 ++++++ .config/scripts/network_status.sh | 76 ++++++++ .config/scripts/power_menu.sh | 24 +++ .config/scripts/privacy_status.sh | 143 +++++++++++++++ .config/scripts/show_cover.sh | 50 +++++ .config/scripts/song_detail.sh | 72 ++++++++ .config/scripts/toggle_eww.sh | 13 ++ .config/scripts/volume_info.sh | 38 ++++ .config/waybar/config | 33 ++-- .config/waybar/style.css | 14 +- 22 files changed, 1486 insertions(+), 70 deletions(-) create mode 100644 .config/fish/conf.d/rustup.fish create mode 100644 .config/hypr/hyprlock.conf create mode 100755 .config/scripts/battery_info.sh create mode 100755 .config/scripts/cpu_status.sh create mode 100755 .config/scripts/datetime_info.sh create mode 100755 .config/scripts/memory_status.sh create mode 100755 .config/scripts/network_speed.sh create mode 100755 .config/scripts/network_status.sh create mode 100755 .config/scripts/power_menu.sh create mode 100755 .config/scripts/privacy_status.sh create mode 100755 .config/scripts/show_cover.sh create mode 100755 .config/scripts/song_detail.sh create mode 100755 .config/scripts/toggle_eww.sh create mode 100755 .config/scripts/volume_info.sh diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf index 0dbb910..ff07868 100644 --- a/.config/btop/btop.conf +++ b/.config/btop/btop.conf @@ -57,7 +57,7 @@ update_ms = 100 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "cpu lazy" +proc_sorting = "memory" #* Reverse sorting order, True or False. proc_reversed = False diff --git a/.config/eww/eww.css b/.config/eww/eww.css index db4647d..2e3e837 100644 --- a/.config/eww/eww.css +++ b/.config/eww/eww.css @@ -1,8 +1,194 @@ * { all: unset; + font-family: "FontAwesome", "Roboto", "Helvetica", "Arial", sans-serif; + font-size: 14px; +} + +tooltip { + background-color: #1a1a1a; + color: #ffffff; + border: 1px solid #444444; + border-radius: 6px; + padding: 10px 15px; + font-size: 12px; + font-family: "Monospace", "Courier New", monospace; + margin: 4px; +} + +tooltip label { + background-color: transparent; + color: #ffffff; + padding: 0px; + margin: 0px; } .bar { - background-color: black; - color: white; + background-color: #000000; + color: #ffffff; + padding: 4px 12px; + border-radius: 0px; + border: none; + outline: none; } + +/* Workspaces */ +.workspaces { + margin: 0px; + padding: 0px; +} + +.workspace-item { + min-width: 20px; + color: #666666; + padding: 0px; + margin: 0px 8px; +} + +.workspace-item.active { + color: #ffffff; +} + +.workspace-item.active:hover { + color: #cccccc; +} + +/* Music */ +.music-box { + color: #ffffff; + margin: 0px 8px; + padding: 0px; +} + +.music-box:hover { + color: #888888; +} + +/* Clock */ +.clock { + color: #ffffff; + padding: 0px; + margin: 0px 16px; +} + +.clock:hover { + color: #888888; +} + +.clock label { + margin: 0px; + padding: 0px; +} + +/* Privacy */ +.privacy { + color: #ffffff; + font-size: 18px; + margin: 0px 4px; + padding: 0px; +} + +.privacy:hover { + color: #666666; +} + +/* CPU */ +.cpu { + color: #ffffff; + margin: 0px 4px; + padding: 0px; +} + +.cpu:hover { + color: #777777; +} + +/* Memory */ +.memory { + color: #ffffff; + margin: 0px 4px; + padding: 0px; +} + +.memory:hover { + color: #777777; +} + +/* Network */ +.network { + color: #ffffff; + margin: 0px 4px; + padding: 0px; +} + +.network:hover { + color: #777777; +} + +/* Volume */ +.volume { + color: #ffffff; + padding: 0px; + margin: 0px 4px; +} + +.volume:hover { + color: #777777; +} + +.volume.muted { + color: #888888; + opacity: 0.8; + margin: 0px 4px; +} + +.volume.muted:hover { + color: #555555; + opacity: 0.6; +} + +/* Tray */ +.tray { + padding: 0px; + margin: 0px 4px; +} + +/* Battery */ +.battery { + color: #ffffff; + padding: 0px; + margin: 0px 4px; +} + +.battery.charging { + color: #ffffff; +} + +.battery.charging:hover { + color: #777777; +} + +.battery.discharging { + color: #ffffff; +} + +.battery.discharging:hover { + color: #777777; +} + +.battery.full { + color: #ffffff; +} + +.battery.full:hover { + color: #777777; +} + +/* Separators */ +.separator { + color: #444444; + margin: 0px 4px; + padding: 0px; + font-size: 12px; +} + +/* Buttons */ diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index 7ac91a4..75a693e 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -1,37 +1,266 @@ -(defvar time-visible false) +;; Eww configuration - Bar matching waybar setup +;; Using proper tooltip widget for tooltip display + +;; ============================================================================ +;; Variables and Polls +;; ============================================================================ + (defpoll time :interval "1s" - :initial "initial-value" - :run-while time-visible -`date +%x' | '%H:%M:%S`) -(defvar byte_transform 1073741824) ;; 1024*1024*1024 - -(defwidget bar [] - (box :orientation "h" - :class "bar" - :spacing 0 - :valign "center" - (label :text time) - (label :text {round(EWW_CPU.avg, 2)}) - (label :text {round(EWW_RAM.used_mem/byte_transform, 2)}) - (systray :icon-size 20 - :space-evenly false - :spacing 0 - ) - (label :text "${EWW_BATTERY.BATT.capacity} | ${EWW_BATTERY.BATT.status}") -)) + `date '+%H:%M:%S'`) -(defwindow main - :monitor 0 - :geometry (geometry :x "0px" - :y "0px" - :width "99.9%" - :height "30px" - :anchor "top center") - :exclusive true - :stacking "fg" - :reserve (struts :distance "40px" :side "top") - :windowtype "dock" - :wm-ignore true -(bar)) +(defpoll date :interval "1s" + `date '+%A, %B %d, %Y'`) + +(defvar time-format-full true) + +(defvar byte_transform 1073741824) + +;; Music/Player info - using song_detail.sh script +(defpoll music :interval "1s" + `bash ~/.config/scripts/song_detail.sh`) + +(defpoll music-status :interval "1s" + `playerctl status 2>/dev/null || echo "Stopped"`) + +;; Privacy status - monitors screen sharing, audio input/output +(defpoll privacy :interval "1s" + `bash ~/.config/scripts/privacy_status.sh status`) + +(defpoll privacy-details :interval "1s" + `bash ~/.config/scripts/privacy_status.sh details`) + +;; CPU usage +(defpoll cpu-usage :interval "1s" + `top -bn1 2>/dev/null | grep "Cpu(s)" | awk '{print int($2)}' || echo "0"`) + +(defpoll cpu-status :interval "1s" + `bash ~/.config/scripts/cpu_status.sh`) + +;; Memory usage +(defpoll mem-usage :interval "1s" + `free -b 2>/dev/null | awk 'NR==2 {printf "%.1f", $3/1073741824}' || echo "0"`) + +(defpoll mem-total :interval "1s" + `free -b 2>/dev/null | awk 'NR==2 {printf "%.1f", $2/1073741824}' || echo "0"`) + +(defpoll memory-status :interval "1s" + `bash ~/.config/scripts/memory_status.sh`) + +;; Audio volume +(defpoll volume :interval "0ms" + `wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | awk '{printf "%.0f", $2*100}' || echo "0"`) + +(defpoll volume-muted :interval "0ms" + `wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | grep -q MUTED && echo "true" || echo "false"`) + +;; Volume info - includes song details for tooltip +(defpoll volume-info :interval "0ms" + `bash ~/.config/scripts/volume_info.sh`) + +;; DateTime info - shows date/time and system uptime for tooltip +(defpoll datetime-info :interval "1s" + `bash ~/.config/scripts/datetime_info.sh`) + +;; Network speed - shows current download/upload speeds for bar display +(defpoll network-speed :interval "1s" + `bash ~/.config/scripts/network_speed.sh`) + +;; Network status - shows network activity for tooltip +(defpoll network-status :interval "1s" + `bash ~/.config/scripts/network_status.sh`) + +;; Battery +(defpoll battery-capacity :interval "5s" + `cat /sys/class/power_supply/BAT*/capacity 2>/dev/null | head -1 || echo "N/A"`) + +(defpoll battery-status :interval "5s" + `cat /sys/class/power_supply/BAT*/status 2>/dev/null | head -1 || echo "N/A"`) +;; Battery info - detailed tooltip +(defpoll battery-info :interval "5s" + `bash ~/.config/scripts/battery_info.sh`) +;; Active workspace +(defpoll active-ws :interval "0ms" + `hyprctl activeworkspace -j 2>/dev/null | jq -r '.id' || echo "1"`) + +;; ============================================================================ +;; Widgets +;; ============================================================================ + +;; Workspace display (show only active) +(defwidget workspaces-widget [] + (eventbox + (label :class "workspace-item active" + :text active-ws))) + +;; Music widget - click to play/pause, right-click to show cover +(defwidget music-widget [] + (eventbox :onclick "playerctl play-pause" + :onrightclick "bash ~/.config/scripts/show_cover.sh" + :class "music-box" + (label :text music))) + +;; Clock widget - left-click to toggle format, right-click to open calendar +(defwidget clock-widget [] + (tooltip + (label :text datetime-info + :class "tooltip-text") + (eventbox :onclick "eww update time-format-full=${time-format-full == "true" ? "false" : "true"}" + :onrightclick "gnome-calendar 2>/dev/null || zenity --calendar 2>/dev/null || notify-send 'Calendar' '${date}'" + :class "clock" + (label :text {time-format-full == "true" ? "${time} | ${date}" : time})))) + +;; Privacy widget - shows indicators only when active +(defwidget privacy-widget [] + (box :visible {privacy != ""} + :space-evenly false + :spacing 4 + (tooltip + (label :text privacy-details + :class "tooltip-text") + (eventbox + (label :class "privacy" + :text privacy))))) + +;; CPU widget +(defwidget cpu-widget [] + (tooltip + (label :text cpu-status + :class "tooltip-text") + (eventbox + (label :class "cpu" + :text "⚙ ${cpu-usage}%")))) + +;; Memory widget - horizontal bars indicator (thin) +(defwidget memory-widget [] + (tooltip + (label :text memory-status + :class "tooltip-text") + (eventbox + (label :class "memory" + :text {mem-usage < 5 ? "◼ ${mem-usage}" : + mem-usage < 10 ? "◼◼ ${mem-usage}" : + mem-usage < 15 ? "◼◼◼ ${mem-usage}" : + mem-usage < 20 ? "◼◼◼◼ ${mem-usage}" : + mem-usage < 25 ? "◼◼◼◼◼ ${mem-usage}" : + mem-usage < 30 ? "◼◼◼◼◼◼ ${mem-usage}" : + mem-usage < 40 ? "◼◼◼◼◼◼◼ ${mem-usage}" : + mem-usage < 50 ? "◼◼◼◼◼◼◼◼ ${mem-usage}" : + mem-usage < 60 ? "◼◼◼◼◼◼◼◼◼ ${mem-usage}" : + mem-usage < 70 ? "◼◼◼◼◼◼◼◼◼◼ ${mem-usage}" : + mem-usage < 80 ? "◼◼◼◼◼◼◼◼◼◼◼ ${mem-usage}" : + mem-usage < 90 ? "◼◼◼◼◼◼◼◼◼◼◼◼ ${mem-usage}" : + "◼◼◼◼◼◼◼◼◼◼◼◼◼ ${mem-usage}"})))) + +;; Network widget +(defwidget network-widget [] + (tooltip + (label :text network-status + :class "tooltip-text") + (eventbox + (label :class "network" + :text network-speed)))) + +;; Volume widget - sine wave icon +(defwidget volume-widget [] + (tooltip + (label :text volume-info + :class "tooltip-text") + (eventbox :onclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + :onrightclick "pavucontrol &" + :class {volume-muted == "true" ? "volume muted" : "volume"} + (label :text {volume-muted == "true" ? + "✕ ${volume}%" : + "∿ ${volume}%"})))) + +;; Battery widget - only shows if battery exists +(defwidget battery-widget [] + (box :visible {battery-capacity != "N/A"} + :space-evenly false + (tooltip + (label :text battery-info + :class "tooltip-text") + (eventbox + (label :class {battery-status == "Charging" ? "battery charging" : + battery-status == "Discharging" ? "battery discharging" : + battery-status == "Full" ? "battery full" : + "battery"} + :text {battery-capacity < 10 ? "▁ ${battery-capacity}%" : + battery-capacity < 25 ? "▂ ${battery-capacity}%" : + battery-capacity < 50 ? "▃ ${battery-capacity}%" : + battery-capacity < 75 ? "▄ ${battery-capacity}%" : + "▅ ${battery-capacity}%"}))))) + +;; System tray +(defwidget tray-widget [] + (box :orientation "h" + :space-evenly false + :spacing 5 + :class "tray" + (systray :icon-size 20 + :space-evenly false + :spacing 5))) + +;; ============================================================================ +;; Main Bar Layout +;; ============================================================================ + +(defwidget bar [] + (box :orientation "h" + :class "bar" + :spacing 16 + :space-evenly false + :valign "center" + :height 30 + + ;; Left: Workspaces and Music + (box :orientation "h" + :space-evenly false + :spacing 20 + (workspaces-widget) + (music-widget)) + + ;; Center: Clock (expanded) + (box :orientation "h" + :hexpand true + :halign "center" + (clock-widget)) + + ;; Right: Status and controls + (box :orientation "h" + :space-evenly false + :spacing 12 + ;; Privacy indicators + (privacy-widget) + + ;; Stats grouped with proper spacing + (box :orientation "h" + :space-evenly false + :spacing 12 + (cpu-widget) + (memory-widget) + (network-widget) + (volume-widget) + (battery-widget)) + + ;; System tray + (tray-widget)))) + +;; ============================================================================ +;; Main Window +;; ============================================================================ + +(defwindow main + :monitor 0 + :geometry (geometry :x "0px" + :y "0px" + :width "99.9%" + :height "34px" + :anchor "top center") + :exclusive true + :stacking "fg" + :reserve (struts :distance "40px" :side "top") + :windowtype "dock" + :wm-ignore true + (bar)) diff --git a/.config/fish/conf.d/rustup.fish b/.config/fish/conf.d/rustup.fish new file mode 100644 index 0000000..e4cb363 --- /dev/null +++ b/.config/fish/conf.d/rustup.fish @@ -0,0 +1 @@ +source "$HOME/.cargo/env.fish" diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index ea1645a..e5ecc56 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -1,6 +1,6 @@ monitor=,preferred,auto,auto # monitor = eDP-1, 2880x1800@90, 0x1080, 2 -# monitor = HDMI-A-1, 1920x1080@75, 0x0, 1 +monitor = HDMI-A-1, 1920x1080@75, 0x0, 1 # monitor = eDP-1, disable bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable" bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, enable" @@ -9,9 +9,9 @@ bindl = , switch:off:Lid Switch, exec, hyprctl keyword input:touchdevice:enabled bindl = , switch:off:Lid Switch, exec, hyprctl reload && hyprctl keyword input:touchdevice:enabled false # bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 2880x1800@90, 0x1080, 2" monitor = HDMI-A-1, disable -exec-once = sleep 1 && waybar -# exec-once = sleep 1 && eww daemon -# exec-once = sleep 1 && eww open main +# exec-once = sleep 1 && waybar +exec-once = sleep 1 && eww daemon +exec-once = sleep 1 && eww open main exec-once = sleep 2 && nm-applet exec-once = sleep 2 && blueman-applet exec-once = sleep 2 && hyprpaper @@ -22,8 +22,9 @@ exec-once = sleep 3 && wl-paste --type text --watch cliphist store # Stores only exec-once = sleep 3 && wl-paste --type image --watch cliphist store # Stores only image data -exec = gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" # for GTK3 apps -exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps +# exec = gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" # for GTK3 apps +# exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps +# exec = gsettings set org.gnome.desktop.interface icon-theme 'papirus-dark' env = QT_QPA_PLATFORMTHEME,qt6ct # for Qt apps env = QT_QPA_PLATFORMTHEME, qt6ct @@ -35,16 +36,18 @@ env = XDG_CURRENT_SESSION, Hyprland # render:explicit_sync = true # legacy command it's deprecated in 0.50 and now it's always enable $terminal = wezterm start --always-new-process -$fileManager = cosmic-files +$fileManager = nautilus --new-window $active_menu = rofi -show $menu = rofi -show drun -show-icons $menu_unsafe = mullvad-exclude rofi -show drun -show-icons $clipboard = cliphist list | rofi -dmenu -show-icons | cliphist decode | wl-copy $screenshot = grim "$HOME/Pictures/Screenshots/$(date '+%y%m%d_%H-%M-%S').png" | grim - | wl-copy $screenshot_with_area_selector = grim -g "$(slurp)" - | wl-copy +$power_menu = bash ~/.config/scripts/power_menu.sh $browser = flatpak run io.github.ungoogled_software.ungoogled_chromium --enable-features=MiddleClickAutoscroll $browser_unsafe = mullvad-exclude flatpak run com.brave.Browser --incognito --enable-features=MiddleClickAutoscroll $signal = flatpak run org.signal.Signal +$deezer = flatpak run app.zen_browser.zen $mainMod = SUPER $my_trigger = Alt @@ -67,14 +70,14 @@ bind = , Print, exec, $screenshot bind = $my_trigger, F, exec, $browser bind = $my_trigger SHIFT, F, exec, $browser_unsafe bind = Shift, Print, exec, $screenshot_with_area_selector +bind = $mainMod, L, exec, hyprlock +bind = $mainMod, Escape, exec, $power_menu -$tahinli_source = /var/lib/flatpak/exports/bin/io.github.ungoogled_software.ungoogled_chromium --app=https://git.tahinli.com --class=dev.heppen.webapps.Source7800 --name=dev.heppen.webapps.Source7800 --user-data-dir="/home/tahinli/.var/app/dev.heppen.webapps/data/quick-webapps/profiles/io.github.ungoogled_software.ungoogled_chromium/Source7800" -$whatsapp = /var/lib/flatpak/exports/bin/io.github.ungoogled_software.ungoogled_chromium --app=https://web.whatsapp.com --class=dev.heppen.webapps.WhatsApp8679 --name=dev.heppen.webapps.WhatsApp8679 --user-data-dir="/home/tahinli/.var/app/dev.heppen.webapps/data/quick-webapps/profiles/io.github.ungoogled_software.ungoogled_chromium/WhatsApp8679" $discord = flatpak run dev.vencord.Vesktop $youtube = mullvad-exclude flatpak run io.freetubeapp.FreeTube -$deezer = mullvad-exclude /var/lib/flatpak/exports/bin/io.github.ungoogled_software.ungoogled_chromium --app=https://deezer.com --class=dev.heppen.webapps.Deezer6664 --name=dev.heppen.webapps.Deezer6664 --user-data-dir="/home/tahinli/.var/app/dev.heppen.webapps/data/quick-webapps/profiles/io.github.ungoogled_software.ungoogled_chromium/Deezer6664" -$mail = /var/lib/flatpak/exports/bin/io.github.ungoogled_software.ungoogled_chromium --app=https://mail.proton.me --class=dev.heppen.webapps.ProtonMail9657 --name=dev.heppen.webapps.ProtonMail9657 --user-data-dir="/home/tahinli/.var/app/dev.heppen.webapps/data/quick-webapps/profiles/io.github.ungoogled_software.ungoogled_chromium/ProtonMail9657" $code = zed +$mail = flatpak run me.proton.Mail +$whatsapp = flatpak run com.rtosta.zapzap workspace = 100, on-created-empty: $code workspace = 101, on-created-empty: $tahinli_source @@ -101,6 +104,7 @@ bind = Alt, F4, killactive, bind = Alt, 4, killactive, bind = $mainMod $my_trigger, F4, exit, bind = $mainMod, H, exec, pkill -SIGUSR1 waybar +bind = $mainMod, H, exec, ~/.config/scripts/toggle_eww.sh binds { allow_workspace_cycles = true } @@ -231,6 +235,14 @@ misc { disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :( } +# =================================== +# Power Management +# =================================== +# Super + Escape: Open power menu +# Super + Shift + Q: Quick suspend +# Super + Shift + R: Quick reboot +# Super + Shift + S: Quick shutdown + input { kb_layout = tr kb_variant = diff --git a/.config/hypr/hyprlock.conf b/.config/hypr/hyprlock.conf new file mode 100644 index 0000000..fd268f9 --- /dev/null +++ b/.config/hypr/hyprlock.conf @@ -0,0 +1,66 @@ +# Hyprlock Configuration +# Lock screen with date/time display, password authentication, and music info + +# Background image +background { + path = ~/Pictures/ryunosuke-kikuno-VXp-9HwN1eg-unsplash.jpg +} + +# Date label - displays current date in center +label { + monitor = + text = cmd[update:1000] echo -e "$(LC_TIME=en_GB.UTF-8 date +"%A, %B %d")" + color = rgba(180, 200, 215, 0.90) + font_size = 25 + font_family = SF Pro Display Semibold + position = 0, 350 + halign = center + valign = center +} + +# Time label - displays current time in large format at center +label { + monitor = + text = cmd[update:1000] echo "$(date +"%H:%M:%S")" + color = rgba(180, 200, 215, 0.90) + font_size = 120 + font_family = SF Pro Display Bold + position = 0, 230 + halign = center + valign = center +} + +# Password input field with authentication status feedback +input-field { + monitor = + size = 280, 55 + outline_thickness = 2 + dots_size = 0.2 + dots_spacing = 0.2 + dots_center = true + outer_color = rgba(0, 0, 0, 0) + inner_color = rgba(255, 255, 255, 0.1) + font_color = rgb(180, 200, 215) + fade_on_empty = false + font_family = SF Pro Display Bold + placeholder_text = Password + hide_input = false + position = 0, -210 + halign = center + valign = center + check_color = rgba(255, 223, 0, 1.0) + fail_color = rgba(255, 71, 87, 1.0) + fail_text = Authentication Failed +} + +# Music info label - displays current playing song with duration from song_detail.sh script +label { + monitor = + text = cmd[update:1000] echo "$(~/.config/scripts/song_detail.sh)" + color = rgba(180, 200, 215, 0.75) + font_size = 18 + font_family = JetBrains Mono Nerd, SF Pro Display Bold + position = 0, 50 + halign = center + valign = bottom +} diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf index a7a4919..469ed3f 100644 --- a/.config/hypr/hyprpaper.conf +++ b/.config/hypr/hyprpaper.conf @@ -1,4 +1,4 @@ -$location = ~/Pictures/artem-shuba-V_coeWlO9bQ-unsplash.jpg +$location = ~/Pictures/josh-hild-ufiZJnon-CQ-unsplash.jpg preload = $location wallpaper = eDP-1,$location wallpaper = HDMI-A-1,$location diff --git a/.config/qt6ct/qt6ct.conf b/.config/qt6ct/qt6ct.conf index 9c1da20..8ab5ca2 100644 --- a/.config/qt6ct/qt6ct.conf +++ b/.config/qt6ct/qt6ct.conf @@ -24,7 +24,7 @@ underline_shortcut=1 wheel_scroll_lines=3 [SettingsWindow] -geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x3\xa0\0\0\x3u\0\0\0\0\0\0\0\0\0\0\x1\xd5\0\0\x1\xf9\0\0\0\0\x2\0\0\0\a\x80\0\0\0\0\0\0\0\0\0\0\x3\xa0\0\0\x3u) +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x3\xae\0\0\x3\xfd\0\0\0\0\0\0\0\0\0\0\x3\xae\0\0\x3\xfd\0\0\0\0\x2\0\0\0\a\x80\0\0\0\0\0\0\0\0\0\0\x3\xae\0\0\x3\xfd) [Troubleshooting] force_raster_widgets=1 diff --git a/.config/scripts/battery_info.sh b/.config/scripts/battery_info.sh new file mode 100755 index 0000000..69cd363 --- /dev/null +++ b/.config/scripts/battery_info.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# Battery Information Script +# Displays detailed battery status and health information from real hardware + +BATTERY_DIR=$(ls -d /sys/class/power_supply/BAT* 2>/dev/null | head -1) + +if [ -z "$BATTERY_DIR" ]; then + echo "Battery Details" + echo "===============" + echo "" + echo "No battery detected" + exit 1 +fi + +# Read battery information +CAPACITY=$(cat "$BATTERY_DIR/capacity" 2>/dev/null || echo "N/A") +STATUS=$(cat "$BATTERY_DIR/status" 2>/dev/null || echo "N/A") +HEALTH=$(cat "$BATTERY_DIR/health" 2>/dev/null || echo "N/A") +TECHNOLOGY=$(cat "$BATTERY_DIR/technology" 2>/dev/null || echo "N/A") +CYCLE_COUNT=$(cat "$BATTERY_DIR/cycle_count" 2>/dev/null || echo "N/A") + +CURRENT=$(cat "$BATTERY_DIR/current_now" 2>/dev/null || echo "0") +VOLTAGE=$(cat "$BATTERY_DIR/voltage_now" 2>/dev/null || echo "0") +POWER=$(cat "$BATTERY_DIR/power_now" 2>/dev/null || echo "0") +ENERGY_FULL=$(cat "$BATTERY_DIR/energy_full" 2>/dev/null || echo "0") +ENERGY_NOW=$(cat "$BATTERY_DIR/energy_now" 2>/dev/null || echo "0") +TEMP=$(cat "$BATTERY_DIR/temp" 2>/dev/null || echo "0") + +# Format output +echo "Battery Details" +echo "===============" +echo "" +echo "Capacity: ${CAPACITY}%" +echo "Status: $STATUS" +echo "Health: $HEALTH" +echo "Technology: $TECHNOLOGY" +echo "" + +# Convert and display electrical info +if [ "$VOLTAGE" != "0" ]; then + VOLTAGE_V=$(echo "scale=2; $VOLTAGE / 1000000" | bc 2>/dev/null) + echo "Voltage: ${VOLTAGE_V}V" +fi + +if [ "$CURRENT" != "0" ]; then + CURRENT_MA=$((CURRENT / 1000)) + echo "Current: ${CURRENT_MA}mA" +fi + +if [ "$POWER" != "0" ]; then + POWER_W=$(echo "scale=2; $POWER / 1000000" | bc 2>/dev/null) + echo "Power: ${POWER_W}W" +fi + +if [ "$TEMP" != "0" ]; then + TEMP_C=$(echo "scale=1; $TEMP / 10" | bc 2>/dev/null) + echo "Temperature: ${TEMP_C}°C" +fi + +echo "" +echo "Cycle Count: $CYCLE_COUNT" + +# Display energy info +if [ "$ENERGY_FULL" != "0" ]; then + ENERGY_FULL_WH=$(echo "scale=1; $ENERGY_FULL / 1000000" | bc 2>/dev/null) + ENERGY_NOW_WH=$(echo "scale=1; $ENERGY_NOW / 1000000" | bc 2>/dev/null) + echo "Energy Full: ${ENERGY_FULL_WH}Wh" + echo "Energy Now: ${ENERGY_NOW_WH}Wh" +fi + +# Estimate time to full/empty +if [ "$POWER" != "0" ] && [ "$POWER" != "0" ]; then + if [ "$STATUS" = "Discharging" ]; then + TIME_REMAINING=$((ENERGY_NOW / (POWER / 1000000))) + HOURS=$((TIME_REMAINING / 3600)) + MINUTES=$(((TIME_REMAINING % 3600) / 60)) + echo "" + echo "Time to Empty: ${HOURS}h ${MINUTES}m" + elif [ "$STATUS" = "Charging" ]; then + TIME_REMAINING=$(( (ENERGY_FULL - ENERGY_NOW) / (POWER / 1000000))) + HOURS=$((TIME_REMAINING / 3600)) + MINUTES=$(((TIME_REMAINING % 3600) / 60)) + echo "" + echo "Time to Full: ${HOURS}h ${MINUTES}m" + fi +fi diff --git a/.config/scripts/cpu_status.sh b/.config/scripts/cpu_status.sh new file mode 100755 index 0000000..ccaa454 --- /dev/null +++ b/.config/scripts/cpu_status.sh @@ -0,0 +1,210 @@ +#!/bin/bash + +# CPU Status - Shows per-core usage, overall usage history, and temperature history with persistent peak tracking + +HISTORY_FILE="/tmp/cpu_history.txt" +TEMP_HISTORY_FILE="/tmp/cpu_temp_history.txt" +CPU_PEAK_FILE="/tmp/cpu_peak.txt" +CPU_PEAK_TIMESTAMP_FILE="/tmp/cpu_peak_timestamp.txt" +TEMP_PEAK_FILE="/tmp/cpu_temp_peak.txt" +TEMP_PEAK_TIMESTAMP_FILE="/tmp/cpu_temp_peak_timestamp.txt" +LAST_UPDATE_FILE="/tmp/cpu_status_last_update.txt" +MAX_HISTORY=20 +UPDATE_INTERVAL=1000 # milliseconds + +cores=$(nproc) + +# Function to read CPU stats from /proc/stat +read_cpu_stats() { + grep "^cpu" /proc/stat | grep -v "^cpu " | head -n $(nproc) +} + +# Function to calculate usage from stats +calculate_usage() { + local prev_line="$1" + local curr_line="$2" + + read -r prev_cpu prev_user prev_nice prev_system prev_idle prev_iowait prev_irq prev_softirq <<< "$prev_line" + read -r curr_cpu curr_user curr_nice curr_system curr_idle curr_iowait curr_irq curr_softirq <<< "$curr_line" + + local user_diff=$((curr_user - prev_user)) + local nice_diff=$((curr_nice - prev_nice)) + local system_diff=$((curr_system - prev_system)) + local idle_diff=$((curr_idle - prev_idle)) + + local total_diff=$((user_diff + nice_diff + system_diff + idle_diff)) + local used_diff=$((user_diff + nice_diff + system_diff)) + + if [ $total_diff -gt 0 ]; then + echo $((used_diff * 100 / total_diff)) + else + echo 0 + fi +} + +# Check if we should update history (only once every 1s) +current_time_ms=$(date +%s%3N 2>/dev/null || echo $(($(date +%s) * 1000))) +last_update=$(cat "$LAST_UPDATE_FILE" 2>/dev/null || echo 0) +time_diff=$((current_time_ms - last_update)) + +should_update=0 +if [ $time_diff -ge $UPDATE_INTERVAL ]; then + should_update=1 + echo "$current_time_ms" > "$LAST_UPDATE_FILE" +fi + +# Sample CPU stats twice with delay +mapfile -t stats_before < <(read_cpu_stats) +sleep 0.1 +mapfile -t stats_after < <(read_cpu_stats) + +# Get overall CPU usage +cpu_overall=$(top -bn1 2>/dev/null | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1) +cpu_overall_int=${cpu_overall%.*} + +# Only update history if interval has passed +if [ $should_update -eq 1 ]; then + # Get current timestamp + current_time=$(date '+%H:%M:%S') + + # Add to CPU usage history + echo "$cpu_overall_int" >> "$HISTORY_FILE" + tail -n $MAX_HISTORY "$HISTORY_FILE" > "${HISTORY_FILE}.tmp" + mv "${HISTORY_FILE}.tmp" "$HISTORY_FILE" + + # Get CPU temperature from hwmon2 (Tctl) + cpu_temp=0 + if [ -f "/sys/class/hwmon/hwmon2/temp1_input" ]; then + temp_raw=$(cat /sys/class/hwmon/hwmon2/temp1_input 2>/dev/null) + cpu_temp=$((temp_raw / 1000)) + fi + + # Add to temperature history + echo "$cpu_temp" >> "$TEMP_HISTORY_FILE" + tail -n $MAX_HISTORY "$TEMP_HISTORY_FILE" > "${TEMP_HISTORY_FILE}.tmp" + mv "${TEMP_HISTORY_FILE}.tmp" "$TEMP_HISTORY_FILE" + + # Initialize or read persistent CPU peak + if [ ! -f "$CPU_PEAK_FILE" ]; then + echo "$cpu_overall_int" > "$CPU_PEAK_FILE" + echo "$current_time" > "$CPU_PEAK_TIMESTAMP_FILE" + fi + + persistent_cpu_peak=$(cat "$CPU_PEAK_FILE" 2>/dev/null || echo "$cpu_overall_int") + persistent_cpu_peak_time=$(cat "$CPU_PEAK_TIMESTAMP_FILE" 2>/dev/null || echo "$current_time") + + # Update persistent CPU peak if current usage exceeds it + if [ "$cpu_overall_int" -gt "$persistent_cpu_peak" ]; then + persistent_cpu_peak=$cpu_overall_int + persistent_cpu_peak_time=$current_time + echo "$persistent_cpu_peak" > "$CPU_PEAK_FILE" + echo "$persistent_cpu_peak_time" > "$CPU_PEAK_TIMESTAMP_FILE" + fi + + # Initialize or read persistent temperature peak + if [ ! -f "$TEMP_PEAK_FILE" ]; then + echo "$cpu_temp" > "$TEMP_PEAK_FILE" + echo "$current_time" > "$TEMP_PEAK_TIMESTAMP_FILE" + fi + + persistent_temp_peak=$(cat "$TEMP_PEAK_FILE" 2>/dev/null || echo "$cpu_temp") + persistent_temp_peak_time=$(cat "$TEMP_PEAK_TIMESTAMP_FILE" 2>/dev/null || echo "$current_time") + + # Update persistent temperature peak if current temp exceeds it + if [ "$cpu_temp" -gt "$persistent_temp_peak" ]; then + persistent_temp_peak=$cpu_temp + persistent_temp_peak_time=$current_time + echo "$persistent_temp_peak" > "$TEMP_PEAK_FILE" + echo "$persistent_temp_peak_time" > "$TEMP_PEAK_TIMESTAMP_FILE" + fi +else + # If not updating, just read the current peaks for display + cpu_temp=0 + if [ -f "/sys/class/hwmon/hwmon2/temp1_input" ]; then + temp_raw=$(cat /sys/class/hwmon/hwmon2/temp1_input 2>/dev/null) + cpu_temp=$((temp_raw / 1000)) + fi + + persistent_cpu_peak=$(cat "$CPU_PEAK_FILE" 2>/dev/null || echo "$cpu_overall_int") + persistent_cpu_peak_time=$(cat "$CPU_PEAK_TIMESTAMP_FILE" 2>/dev/null || echo "N/A") + persistent_temp_peak=$(cat "$TEMP_PEAK_FILE" 2>/dev/null || echo "$cpu_temp") + persistent_temp_peak_time=$(cat "$TEMP_PEAK_TIMESTAMP_FILE" 2>/dev/null || echo "N/A") +fi + +# Read CPU usage history +mapfile -t cpu_history < "$HISTORY_FILE" + +# Read temperature history +mapfile -t temp_history < "$TEMP_HISTORY_FILE" + +# Display header +echo "CPU Status" +echo "==========" +echo "" + +# Get current CPU governor +current_governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo "N/A") +echo "Governor: $current_governor" +echo "" + +# Draw CPU usage history bar chart +cpu_bar="" +for val in "${cpu_history[@]}"; do + if [ "$val" -lt 5 ]; then + cpu_bar="${cpu_bar}▁" + elif [ "$val" -lt 20 ]; then + cpu_bar="${cpu_bar}▂" + elif [ "$val" -lt 35 ]; then + cpu_bar="${cpu_bar}▃" + elif [ "$val" -lt 50 ]; then + cpu_bar="${cpu_bar}▄" + elif [ "$val" -lt 65 ]; then + cpu_bar="${cpu_bar}▅" + elif [ "$val" -lt 80 ]; then + cpu_bar="${cpu_bar}▆" + elif [ "$val" -lt 90 ]; then + cpu_bar="${cpu_bar}▇" + else + cpu_bar="${cpu_bar}█" + fi +done + +echo "CPU Usage:" +echo " History: $cpu_bar" +echo " Current: ${cpu_overall_int}% | Peak: ${persistent_cpu_peak}% (at ${persistent_cpu_peak_time})" +echo "" + +# Draw temperature history bar chart (scale 30-80°C) +temp_bar="" +for val in "${temp_history[@]}"; do + # Map temperature to 30-80°C range to bar chart + if [ "$val" -lt 35 ]; then + temp_bar="${temp_bar}▁" + elif [ "$val" -lt 40 ]; then + temp_bar="${temp_bar}▂" + elif [ "$val" -lt 45 ]; then + temp_bar="${temp_bar}▃" + elif [ "$val" -lt 50 ]; then + temp_bar="${temp_bar}▄" + elif [ "$val" -lt 55 ]; then + temp_bar="${temp_bar}▅" + elif [ "$val" -lt 60 ]; then + temp_bar="${temp_bar}▆" + elif [ "$val" -lt 70 ]; then + temp_bar="${temp_bar}▇" + else + temp_bar="${temp_bar}█" + fi +done + +echo "Temperature:" +echo " History: $temp_bar" +echo " Current: ${cpu_temp}°C | Peak: ${persistent_temp_peak}°C (at ${persistent_temp_peak_time})" +echo "" + +# Display per-core usage +echo "Per-Core Usage:" +for i in "${!stats_before[@]}"; do + usage=$(calculate_usage "${stats_before[$i]}" "${stats_after[$i]}") + printf " Core %2d: %3d%%\n" "$i" "$usage" +done diff --git a/.config/scripts/datetime_info.sh b/.config/scripts/datetime_info.sh new file mode 100755 index 0000000..c5f1f1e --- /dev/null +++ b/.config/scripts/datetime_info.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# DateTime Info - Shows system uptime with seconds + +# Get system uptime in seconds +uptime_seconds=$(cat /proc/uptime | awk '{print int($1)}') + +# Convert to readable format with seconds +days=$((uptime_seconds / 86400)) +hours=$(((uptime_seconds % 86400) / 3600)) +minutes=$(((uptime_seconds % 3600) / 60)) +seconds=$((uptime_seconds % 60)) + +# Build uptime string +uptime_str="" +if [ $days -gt 0 ]; then + uptime_str="${days} day$([ $days -gt 1 ] && echo 's' || true)" + [ $hours -gt 0 ] && uptime_str="$uptime_str, ${hours} hour$([ $hours -gt 1 ] && echo 's' || true)" + [ $minutes -gt 0 ] && uptime_str="$uptime_str, ${minutes} minute$([ $minutes -gt 1 ] && echo 's' || true)" + [ $seconds -gt 0 ] && uptime_str="$uptime_str, ${seconds} second$([ $seconds -gt 1 ] && echo 's' || true)" +elif [ $hours -gt 0 ]; then + uptime_str="${hours} hour$([ $hours -gt 1 ] && echo 's' || true)" + [ $minutes -gt 0 ] && uptime_str="$uptime_str, ${minutes} minute$([ $minutes -gt 1 ] && echo 's' || true)" + [ $seconds -gt 0 ] && uptime_str="$uptime_str, ${seconds} second$([ $seconds -gt 1 ] && echo 's' || true)" +else + uptime_str="${minutes} minute$([ $minutes -gt 1 ] && echo 's' || true), ${seconds} second$([ $seconds -gt 1 ] && echo 's' || true)" +fi + +# Display with proper alignment +echo "Uptime" +echo "======" +echo "" +echo " $uptime_str" diff --git a/.config/scripts/memory_status.sh b/.config/scripts/memory_status.sh new file mode 100755 index 0000000..536a884 --- /dev/null +++ b/.config/scripts/memory_status.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Memory Status - Shows memory usage with history bar chart and persistent peak tracking + +HISTORY_FILE="/tmp/memory_history.txt" +PEAK_FILE="/tmp/memory_peak.txt" +PEAK_TIMESTAMP_FILE="/tmp/memory_peak_timestamp.txt" +LAST_UPDATE_FILE="/tmp/memory_status_last_update.txt" +MAX_HISTORY=20 +UPDATE_INTERVAL=1000 # milliseconds + +# Get current memory usage +get_memory() { + free -b 2>/dev/null | awk 'NR==2 { + used = $3 + total = $2 + percent = int(used * 100 / total) + printf "%.1f %.1f %d", used/1073741824, total/1073741824, percent + }' +} + +# Read memory and add to history +current=$(get_memory) +used=$(echo $current | awk '{print $1}') +total=$(echo $current | awk '{print $2}') +percent=$(echo $current | awk '{print $3}') + +# Check if we should update history (only once every 1s) +current_time_ms=$(date +%s%3N 2>/dev/null || echo $(($(date +%s) * 1000))) +last_update=$(cat "$LAST_UPDATE_FILE" 2>/dev/null || echo 0) +time_diff=$((current_time_ms - last_update)) + +should_update=0 +if [ $time_diff -ge $UPDATE_INTERVAL ]; then + should_update=1 + echo "$current_time_ms" > "$LAST_UPDATE_FILE" +fi + +# Only update history if interval has passed +if [ $should_update -eq 1 ]; then + # Get current timestamp + current_time=$(date '+%H:%M:%S') + + # Append to history file + echo "$used" >> "$HISTORY_FILE" + + # Keep only last N entries + tail -n $MAX_HISTORY "$HISTORY_FILE" > "${HISTORY_FILE}.tmp" + mv "${HISTORY_FILE}.tmp" "$HISTORY_FILE" + + # Initialize or read persistent peak + if [ ! -f "$PEAK_FILE" ]; then + echo "$used" > "$PEAK_FILE" + echo "$current_time" > "$PEAK_TIMESTAMP_FILE" + fi + + persistent_peak=$(cat "$PEAK_FILE" 2>/dev/null || echo "$used") + persistent_peak_time=$(cat "$PEAK_TIMESTAMP_FILE" 2>/dev/null || echo "$current_time") + + # Update persistent peak if current usage exceeds it + if (( $(echo "$used > $persistent_peak" | bc -l) )); then + persistent_peak=$used + persistent_peak_time=$current_time + echo "$persistent_peak" > "$PEAK_FILE" + echo "$persistent_peak_time" > "$PEAK_TIMESTAMP_FILE" + fi +else + # If not updating, just read the current peaks for display + persistent_peak=$(cat "$PEAK_FILE" 2>/dev/null || echo "$used") + persistent_peak_time=$(cat "$PEAK_TIMESTAMP_FILE" 2>/dev/null || echo "N/A") +fi + +# Read history and create bar chart +mapfile -t history < "$HISTORY_FILE" + +# Create bar chart +echo "Memory Status" +echo "=============" +echo "" + +# Draw bar chart based on history +bar="" +for val in "${history[@]}"; do + # Calculate percentage and convert to bar + bar_percent=$(echo "scale=0; $val * 100 / $total" | bc) + if [ "$bar_percent" -lt 5 ]; then + bar="${bar}▁" + elif [ "$bar_percent" -lt 20 ]; then + bar="${bar}▂" + elif [ "$bar_percent" -lt 35 ]; then + bar="${bar}▃" + elif [ "$bar_percent" -lt 50 ]; then + bar="${bar}▄" + elif [ "$bar_percent" -lt 65 ]; then + bar="${bar}▅" + elif [ "$bar_percent" -lt 80 ]; then + bar="${bar}▆" + elif [ "$bar_percent" -lt 90 ]; then + bar="${bar}▇" + else + bar="${bar}█" + fi +done + +echo "History: $bar" +echo "" + +# Show current and peak with timestamp +persistent_peak_percent=$(echo "scale=1; $persistent_peak * 100 / $total" | bc) + +echo "Current: ${used} GB / ${total} GB (${percent}%)" +echo "Peak: ${persistent_peak} GB / ${total} GB (${persistent_peak_percent}%) (at ${persistent_peak_time})" diff --git a/.config/scripts/network_speed.sh b/.config/scripts/network_speed.sh new file mode 100755 index 0000000..cf403f7 --- /dev/null +++ b/.config/scripts/network_speed.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Network Speed - Shows current download and upload speeds for bar display + +# Get network interfaces +get_network_stats() { + # Get RX/TX bytes for all interfaces except lo + cat /proc/net/dev | grep -v "lo:" | grep ":" | awk '{ + rx += $2 + tx += $10 + } + END { + printf "%d %d\n", rx, tx + }' +} + +# Store previous values +HISTORY_FILE="/tmp/network_speed_history.txt" +PREV_RX=0 +PREV_TX=0 + +# Read previous values if they exist +if [ -f "$HISTORY_FILE" ]; then + read PREV_RX PREV_TX < "$HISTORY_FILE" +fi + +# Get current values +read CURR_RX CURR_TX <<< $(get_network_stats) + +# Calculate difference (bytes since last check) +DELTA_RX=$((CURR_RX - PREV_RX)) +DELTA_TX=$((CURR_TX - PREV_TX)) + +# Handle negative values (counter reset) +[ $DELTA_RX -lt 0 ] && DELTA_RX=0 +[ $DELTA_TX -lt 0 ] && DELTA_TX=0 + +# Convert to KB/s (assuming 1 second polling interval) +RX_SPEED=$((DELTA_RX / 1024)) +TX_SPEED=$((DELTA_TX / 1024)) + +# Save current values for next iteration +echo "$CURR_RX $CURR_TX" > "$HISTORY_FILE" + +# Format speeds with units +format_speed() { + local speed=$1 + if [ $speed -lt 1024 ]; then + printf "%dᵏᵇ/ˢ" "$speed" + else + printf "%dᵐᵇ/ˢ" "$((speed / 1024))" + fi +} + +RX_FORMATTED=$(format_speed $RX_SPEED) +TX_FORMATTED=$(format_speed $TX_SPEED) + +# Output for bar display +echo "⬇${RX_FORMATTED} ⬆${TX_FORMATTED}" diff --git a/.config/scripts/network_status.sh b/.config/scripts/network_status.sh new file mode 100755 index 0000000..7f58184 --- /dev/null +++ b/.config/scripts/network_status.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# Network Status - Shows network activity and connection status + +# Get network interfaces +get_network_stats() { + # Get RX/TX bytes for all interfaces except lo + cat /proc/net/dev | grep -v "lo:" | grep ":" | awk '{ + rx += $2 + tx += $10 + } + END { + printf "%d %d\n", rx, tx + }' +} + +# Store previous values +HISTORY_FILE="/tmp/network_history.txt" +PREV_RX=0 +PREV_TX=0 + +# Read previous values if they exist +if [ -f "$HISTORY_FILE" ]; then + read PREV_RX PREV_TX < "$HISTORY_FILE" +fi + +# Get current values +read CURR_RX CURR_TX <<< $(get_network_stats) + +# Calculate difference (bytes since last check) +DELTA_RX=$((CURR_RX - PREV_RX)) +DELTA_TX=$((CURR_TX - PREV_TX)) + +# Handle negative values (counter reset) +[ $DELTA_RX -lt 0 ] && DELTA_RX=0 +[ $DELTA_TX -lt 0 ] && DELTA_TX=0 + +# Convert to KB/s (assuming 1 second polling interval) +RX_SPEED=$((DELTA_RX / 1024)) +TX_SPEED=$((DELTA_TX / 1024)) + +# Save current values for next iteration +echo "$CURR_RX $CURR_TX" > "$HISTORY_FILE" + +# Format speeds with units +format_speed() { + local speed=$1 + if [ $speed -lt 1024 ]; then + echo "${speed}KB/s" + else + echo "$((speed / 1024))MB/s" + fi +} + +RX_FORMATTED=$(format_speed $RX_SPEED) +TX_FORMATTED=$(format_speed $TX_SPEED) + +# Check if network is connected and get active interface +ACTIVE_INTERFACE=$(ip link | grep "state UP" | grep -oP '^\d+: \K[^:]+' | head -1) +CONNECTED=$(ip link | grep -c "state UP") + +# Display network status +echo "Network" +echo "=======" +echo "" + +if [ $CONNECTED -gt 0 ]; then + echo " Status: Connected" + echo " Interface: $ACTIVE_INTERFACE" +else + echo " Status: Disconnected" +fi + +echo "" +echo " ⬇ Download: $RX_FORMATTED" +echo " ⬆ Upload: $TX_FORMATTED" diff --git a/.config/scripts/power_menu.sh b/.config/scripts/power_menu.sh new file mode 100755 index 0000000..e03df6f --- /dev/null +++ b/.config/scripts/power_menu.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Power Management Menu +# Provides quick access to suspend, shutdown, reboot, and logout options + +# Create menu options +menu=$(echo -e "🔴 Shutdown\n🔄 Reboot\n😴 Suspend\n🚪 Logout\n❌ Cancel" | rofi -dmenu -p "Power" -i) + +case "$menu" in + "🔴 Shutdown") + systemctl poweroff + ;; + "🔄 Reboot") + systemctl reboot + ;; + "😴 Suspend") + systemctl suspend + ;; + "🚪 Logout") + hyprctl dispatch exit + ;; + "❌ Cancel") + ;; +esac diff --git a/.config/scripts/privacy_status.sh b/.config/scripts/privacy_status.sh new file mode 100755 index 0000000..16b09dd --- /dev/null +++ b/.config/scripts/privacy_status.sh @@ -0,0 +1,143 @@ +#!/bin/bash + +# Privacy indicator script for eww bar +# Usage: privacy.sh [status|details] +# status - Returns just the icons (for bar display) +# details - Returns detailed info (for tooltip) + +# Shared detection logic +detect_audio_output() { + if command -v pactl &> /dev/null; then + if pactl list sink-inputs 2>/dev/null | grep -q "Corked: no"; then + return 0 + fi + fi + return 1 +} + +detect_audio_input() { + if command -v pactl &> /dev/null; then + if pactl list source-outputs 2>/dev/null | grep -q "Corked: no"; then + return 0 + fi + fi + return 1 +} + +detect_screen_sharing() { + if command -v pw-dump &> /dev/null; then + if pw-dump 2>/dev/null | grep -q "xdg-desktop-portal.*capture"; then + return 0 + fi + fi + return 1 +} + +detect_camera() { + if command -v lsof &> /dev/null; then + # Check if any /dev/video* devices are open + if lsof /dev/video* 2>/dev/null | grep -qv "COMMAND"; then + return 0 + fi + fi + return 1 +} + +get_output_apps() { + if command -v pactl &> /dev/null; then + pactl list sink-inputs 2>/dev/null | grep -oP '(?<=application\.name = ")[^"]*' | sort -u | paste -sd ', ' - + fi +} + +get_input_apps() { + if command -v pactl &> /dev/null; then + pactl list source-outputs 2>/dev/null | grep -oP '(?<=application\.name = ")[^"]*' | sort -u | paste -sd ', ' - + fi +} + +get_screen_app() { + if command -v pw-dump &> /dev/null; then + if pw-dump 2>/dev/null | jq -r '.[] | select(.info.props["application.name"] != null) | .info.props["application.name"]' 2>/dev/null | grep -q "Brave"; then + echo "Brave" + elif pw-dump 2>/dev/null | jq -r '.[] | select(.info.props["application.name"] != null) | .info.props["application.name"]' 2>/dev/null | grep -q "Zen"; then + echo "Zen" + fi + fi +} + +get_camera_apps() { + if command -v lsof &> /dev/null; then + lsof /dev/video* 2>/dev/null | awk 'NR>1 {print $1}' | sort -u | paste -sd ', ' - + fi +} + +# Show status (just icons for bar) +show_status() { + output="" + + if detect_audio_output; then + output+="⌣ " + fi + + if detect_audio_input; then + output+="⌢ " + fi + + if detect_screen_sharing; then + output+="⊞ " + fi + + if detect_camera; then + output+="⊙ " + fi + + echo "$output" | xargs +} + +# Show details (for tooltip) +show_details() { + lines=() + + if detect_audio_output; then + output_apps=$(get_output_apps) + if [ -n "$output_apps" ]; then + lines+=("⌣ Playing: $output_apps") + fi + fi + + if detect_audio_input; then + input_apps=$(get_input_apps) + if [ -n "$input_apps" ]; then + lines+=("⌢ Recording: $input_apps") + fi + fi + + if detect_screen_sharing; then + screen_app=$(get_screen_app) + if [ -n "$screen_app" ]; then + lines+=("⊞ Sharing: $screen_app") + fi + fi + + if detect_camera; then + camera_apps=$(get_camera_apps) + if [ -n "$camera_apps" ]; then + lines+=("⊙ Camera: $camera_apps") + fi + fi + + printf "%s\n" "${lines[@]}" +} + +# Main logic +case "${1:-status}" in + status) + show_status + ;; + details) + show_details + ;; + *) + show_status + ;; +esac diff --git a/.config/scripts/show_cover.sh b/.config/scripts/show_cover.sh new file mode 100755 index 0000000..2290b29 --- /dev/null +++ b/.config/scripts/show_cover.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Get cover art URL from playerctl +cover_url=$(playerctl metadata mpris:artUrl 2>/dev/null) + +if [[ -z "$cover_url" ]]; then + notify-send "No cover art available" + exit 1 +fi + +# Handle file:// URLs +if [[ "$cover_url" == file://* ]]; then + cover_path="${cover_url#file://}" + # Decode URL encoding + cover_path=$(printf '%b' "${cover_path//%/\\x}") + + if [[ ! -f "$cover_path" ]]; then + notify-send "Cover file not found" + exit 1 + fi +else + # It's a URL, download it + cover_path="/tmp/album_cover_$(date +%s).jpg" + + if command -v curl &> /dev/null; then + curl -s -L "$cover_url" -o "$cover_path" 2>/dev/null + elif command -v wget &> /dev/null; then + wget -q "$cover_url" -O "$cover_path" 2>/dev/null + else + notify-send "Need curl or wget to download cover" + exit 1 + fi + + if [[ ! -f "$cover_path" ]] || [[ ! -s "$cover_path" ]]; then + notify-send "Failed to download cover art" + exit 1 + fi +fi + +# Display the cover using available image viewer +if command -v feh &> /dev/null; then + feh --geometry 500x500 --title "Album Cover" "$cover_path" 2>/dev/null & +elif command -v eog &> /dev/null; then + eog "$cover_path" 2>/dev/null & +elif command -v display &> /dev/null; then + display -geometry 500x500 "$cover_path" 2>/dev/null & +else + notify-send "Install feh, eog, or imagemagick to view covers" + exit 1 +fi diff --git a/.config/scripts/song_detail.sh b/.config/scripts/song_detail.sh new file mode 100755 index 0000000..cdef5ee --- /dev/null +++ b/.config/scripts/song_detail.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# Get current playing song from playerctl +if command -v playerctl &> /dev/null; then + # Check if any player is running + if playerctl status &> /dev/null; then + status=$(playerctl status 2>/dev/null) + artist=$(playerctl metadata artist 2>/dev/null) + title=$(playerctl metadata title 2>/dev/null) + duration_us=$(playerctl metadata mpris:length 2>/dev/null) + + # Define cache file for paused position + POSITION_CACHE="/tmp/playerctl_position_cache" + + # Set icon based on playback status + if [[ "$status" == "Playing" ]]; then + icon="▶" + else + icon="⏸" + fi + + # Convert duration from microseconds to MM:SS format + if [[ -n "$duration_us" ]]; then + duration_sec=$((duration_us / 1000000)) + minutes=$((duration_sec / 60)) + seconds=$((duration_sec % 60)) + duration=$(printf "%02d:%02d" $minutes $seconds) + else + duration="" + fi + + # Get current position with caching logic + position="" + position_us=$(playerctl position 2>/dev/null) + + if [[ "$status" == "Playing" ]]; then + # When playing, get live position and cache it + if [[ -n "$position_us" ]]; then + position_sec=$(printf "%.0f" "$position_us") + pos_minutes=$((position_sec / 60)) + pos_seconds=$((position_sec % 60)) + position=$(printf "%02d:%02d" $pos_minutes $pos_seconds) + # Cache the position for when paused + echo "$position" > "$POSITION_CACHE" + fi + else + # When paused, use cached position if available + if [[ -f "$POSITION_CACHE" ]]; then + position=$(cat "$POSITION_CACHE") + fi + fi + + if [[ -n "$artist" && -n "$title" && -n "$duration" && -n "$position" ]]; then + echo "$icon $artist - $title ($position / $duration)" + elif [[ -n "$artist" && -n "$title" && -n "$duration" ]]; then + echo "$icon $artist - $title ($duration)" + elif [[ -n "$title" && -n "$duration" && -n "$position" ]]; then + echo "$icon $title ($position / $duration)" + elif [[ -n "$title" && -n "$duration" ]]; then + echo "$icon $title ($duration)" + elif [[ -n "$artist" && -n "$title" ]]; then + echo "$icon $artist - $title" + elif [[ -n "$title" ]]; then + echo "$icon $title" + else + echo "$icon Music" + fi + else + echo "" + fi +else + echo "" +fi diff --git a/.config/scripts/toggle_eww.sh b/.config/scripts/toggle_eww.sh new file mode 100755 index 0000000..c6f2727 --- /dev/null +++ b/.config/scripts/toggle_eww.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Toggle eww bar visibility +# Check if eww main window is open and toggle accordingly + +if eww active-windows | grep -q "main"; then + eww close main +else + eww open main +fi +``` + +Now let me add the keybind to your Hyprland config: diff --git a/.config/scripts/volume_info.sh b/.config/scripts/volume_info.sh new file mode 100755 index 0000000..ee57e30 --- /dev/null +++ b/.config/scripts/volume_info.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Get volume info with song details for tooltip + +# Get current volume +volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | awk '{printf "%.0f", $2*100}' || echo "0") + +# Get mute status +mute_status=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | grep -q MUTED && echo "true" || echo "false") + +# Get sink info +sink_name=$(pactl info 2>/dev/null | grep "Default Sink:" | awk -F': ' '{print $2}') +sink_desc=$(pactl list sinks 2>/dev/null | grep -A1 "Name: $sink_name" | grep "Description:" | awk -F': ' '{print $2}') + +# Format volume bar (10 segments) +bar_segments=$((volume / 10)) +filled=$(printf '█%.0s' $(seq 1 $bar_segments)) +empty=$(printf '░%.0s' $(seq 1 $((10 - bar_segments)))) +volume_bar="${filled}${empty}" + +# Format mute status +if [[ "$mute_status" == "true" ]]; then + mute_text="Muted" +else + mute_text="Unmuted" +fi + +# Output tooltip +echo "Volume" +echo "======" +echo "" +echo " Status: ${mute_text}" + +if [[ -n "$sink_desc" ]]; then + echo " Device: ${sink_desc}" +fi + +echo "" +echo " ${volume_bar} ${volume}%" diff --git a/.config/waybar/config b/.config/waybar/config index eb83a92..e63518a 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -3,7 +3,7 @@ "position": "top", "height": 34, "spacing": 16, - "modules-left": ["hyprland/workspaces", "mpris"], + "modules-left": ["hyprland/workspaces", "custom/music"], "modules-center": ["clock"], "modules-right": ["privacy", "cpu", "memory", "wireplumber", "tray", "battery"], @@ -47,7 +47,7 @@ "Foot Server": "Terminal" } }, - + "pulseaudio/slider": { "min": 0, "max": 100, @@ -77,18 +77,15 @@ ] }, - "mpris": { + "custom/music": { + "format": "{}", + "exec": "bash ~/.config/scripts/song_detail.sh", + "exec-if": "playerctl status &> /dev/null", "interval": 1, - "format": " {player_icon} {dynamic}", - "format-paused": "{status_icon} {dynamic}", - "player-icons": { - "default": "▶", - "mpv": "🎵" - }, - "status-icons": { - "paused": "⏸" - }, - // "ignored-players": ["firefox"] + "on-click": "playerctl play-pause", + "on-click-right": "bash ~/.config/scripts/show_cover.sh", + "on-scroll-up": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+", + "on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" }, "wireplumber": { @@ -98,7 +95,7 @@ "on-click-right": "pavucontrol", "format-muted": "\uf00d {volume}%" }, - + "hyprland/workspaces": { "format": "{icon}", "active-only": true @@ -126,15 +123,15 @@ "tooltip-format-disconnected": "Disconnected", "max-length": 50 }, - "cpu": { - "interval": 1, - "format": "{usage}%" + "cpu": { + "interval": 1, + "format": "{usage}%" }, "memory": { "interval": 1, "format": "{used:0.1f}" }, - + "clock": { "interval" : 1, "format": "{:%H:%M:%S | %A, %B %d, %Y }", diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 7c153a9..32afaa4 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -1,11 +1,10 @@ #waybar { - color: #FFFFFF; + color: #ffffff; background-color: #000000; /* opacity: 1; */ border-radius: 1px; } - #idle_inhibitor.activated { background-color: #285577; } @@ -34,5 +33,14 @@ #pulseaudio-slider highlight { min-width: 10px; border-radius: 5px; - background-color: green; + background-color: white; +} + +#custom-music { + color: #ffffff; + margin: 0 10px; + background-color: transparent; + border: none; + padding: 0; + box-shadow: none; }