From 3d83681ea8365473ecb4a6e93692df6b93c837d3 Mon Sep 17 00:00:00 2001 From: Kajus Naujokaitis Date: Thu, 28 Nov 2024 10:40:32 +0200 Subject: [PATCH] Desktop: Rework idle behavior, fix popups, adjust lock and login screen styling - Reworked system idle behavior, added stages for dim, lock, and suspend - Added separate config file for swayidle - Adjusted the styling for lock and login screens - Added a custom layout for the lock screen - Added separate config file for gtklock - Reworked volume and brightness popup behavior to trigger only from key presses - Adjusted the order of buttons in taskbar power menu - Use new ghaf-powercontrol script wherever applicable - Hide taskbar keyboard layout indicator - Enabled titlebar icons in labwc config - Added powerbar module to lockscreen Signed-off-by: Kajus Naujokaitis --- modules/common/services/disks.nix | 4 +- modules/desktop/graphics/ewwbar.nix | 238 +++++++--------- modules/desktop/graphics/labwc.config.nix | 103 +++++-- .../desktop/graphics/styles/lock-layout.nix | 137 +++++++++ .../desktop/graphics/styles/lock-style.nix | 83 +++++- .../desktop/graphics/styles/login-style.nix | 75 ++++- modules/desktop/graphics/waybar.config.nix | 265 ------------------ overlays/custom-packages/default.nix | 1 - overlays/custom-packages/waybar/default.nix | 13 - 9 files changed, 460 insertions(+), 459 deletions(-) create mode 100644 modules/desktop/graphics/styles/lock-layout.nix delete mode 100644 modules/desktop/graphics/waybar.config.nix delete mode 100644 overlays/custom-packages/waybar/default.nix diff --git a/modules/common/services/disks.nix b/modules/common/services/disks.nix index 0b58856a0..af2e3e6e2 100644 --- a/modules/common/services/disks.nix +++ b/modules/common/services/disks.nix @@ -72,9 +72,9 @@ in RestartSec = "1"; ExecStart = "${pkgs.udiskie}/bin/udiskie -c /etc/udiskie.yml"; }; - wantedBy = [ "ghaf-session.target" ]; - partOf = [ "ghaf-session.target" ]; + wantedBy = [ "ewwbar.service" ]; after = [ "ewwbar.service" ]; + partOf = [ "ewwbar.service" ]; }; }; } diff --git a/modules/desktop/graphics/ewwbar.nix b/modules/desktop/graphics/ewwbar.nix index b2fc0a2ab..ab295fabb 100644 --- a/modules/desktop/graphics/ewwbar.nix +++ b/modules/desktop/graphics/ewwbar.nix @@ -7,12 +7,14 @@ ... }: let - inherit (builtins) replaceStrings; inherit (lib) optionalString; cfg = config.ghaf.graphics.labwc; useGivc = config.ghaf.givc.enable; ghaf-workspace = pkgs.callPackage ../../../packages/ghaf-workspace { }; + ghaf-powercontrol = pkgs.callPackage ../../../packages/ghaf-powercontrol { + ghafConfig = config.ghaf; + }; inherit (config.ghaf.services.audio) pulseaudioTcpControlPort; launcher-icon = "${pkgs.ghaf-artwork}/icons/launcher.svg"; @@ -52,17 +54,7 @@ let arrow-right-icon = "${pkgs.ghaf-artwork}/icons/arrow-right.svg"; # Called by eww.yuck for updates and reloads - eww = "${pkgs.eww}/bin/eww -c /etc/eww"; - - cliArgs = replaceStrings [ "\n" ] [ " " ] '' - --name ${config.ghaf.givc.adminConfig.name} - --addr ${config.ghaf.givc.adminConfig.addr} - --port ${config.ghaf.givc.adminConfig.port} - ${optionalString config.ghaf.givc.enableTls "--cacert /run/givc/ca-cert.pem"} - ${optionalString config.ghaf.givc.enableTls "--cert /run/givc/gui-vm-cert.pem"} - ${optionalString config.ghaf.givc.enableTls "--key /run/givc/gui-vm-key.pem"} - ${optionalString (!config.ghaf.givc.enableTls) "--notls"} - ''; + ewwCmd = "${pkgs.eww}/bin/eww -c /etc/eww"; eww-bat = pkgs.writeShellApplication { name = "eww-bat"; @@ -162,8 +154,8 @@ let echo "Found connected displays: $displays" # Start eww daemon - ${eww} kill - ${eww} daemon + ${ewwCmd} kill + ${ewwCmd} daemon sleep 0.2 update-vars sleep 0.2 @@ -171,13 +163,13 @@ let # Launch ewwbar for each connected display for ((display=0; display/dev/null - popup_timer_pid=0 - fi - - if ! ${eww} active-windows | grep -q "brightness-popup"; then - ${eww} open brightness-popup - ${eww} update brightness-popup-visible="true" - fi - ( - sleep 2 - ${eww} update brightness-popup-visible="false" - sleep 0.1 - ${eww} close brightness-popup - ) & - - popup_timer_pid=$! - fi - } - icon() { if [ "$1" -eq 0 ]; then echo "${brightness-0-icon}" @@ -281,25 +248,15 @@ let } get() { - if [ -z "$1" ]; then - brightness=$(brightnessctl info | grep -oP '(?<=\().+?(?=%)' | awk '{print $1 + 0.0}') - else - brightness="$1" - fi + brightness=$(brightnessctl info | grep -oP '(?<=\().+?(?=%)' | awk '{print $1 + 0.0}') icon=$(icon "$brightness") echo "{ \"screen\": { \"level\": \"$brightness\" }, \"icon\": \"$icon\" }" } listen() { - prev_brightness="" inotifywait -m -e close_write /sys/class/backlight/*/brightness | while read -r; do - current_brightness=$(brightnessctl info | grep -oP '(?<=\().+?(?=%)' | awk '{print $1 + 0.0}') - get "$current_brightness" & - if [[ "$current_brightness" != "$prev_brightness" ]]; then - show_popup > /dev/null 2>&1 - fi - prev_brightness="$current_brightness" + get & done } @@ -330,31 +287,6 @@ let bashOptions = [ ]; text = '' export PULSE_SERVER=audio-vm:${toString pulseaudioTcpControlPort} - popup_timer_pid=0 - - show_popup() { - if ! ${eww} active-windows | grep -q "quick-settings"; then - # Reset timer - if [ "$popup_timer_pid" -ne 0 ]; then - kill "$popup_timer_pid" 2>/dev/null - popup_timer_pid=0 - fi - - if ! ${eww} active-windows | grep -q "volume-popup"; then - ${eww} open volume-popup - ${eww} update volume-popup-visible="true" - fi - ( - sleep 2 - ${eww} update volume-popup-visible="false" - sleep 0.1 - ${eww} close volume-popup - ) & - - popup_timer_pid=$! - fi - } - icon() { if [[ "$2" == "true" || "$1" -eq 0 ]]; then @@ -369,26 +301,16 @@ let } get() { - if [ -z "$1" ]; then - volume=$(pamixer --get-volume) - else - volume="$1" - fi + volume=$(pamixer --get-volume) muted=$(pamixer --get-mute) icon=$(icon "$volume" "$muted") echo "{ \"level\": \"$volume\", \"muted\": \"$muted\", \"icon\": \"$icon\" }" } listen() { - prev_volume="" pactl subscribe | while read -r event; do if [[ "$event" == *"change"* ]]; then - volume=$(pamixer --get-volume) - get "$volume" & - if [[ "$volume" != "$prev_volume" ]]; then - show_popup > /dev/null 2>&1 - fi - prev_volume="$volume" + get & fi done } @@ -413,39 +335,48 @@ let ''; }; - eww-power = pkgs.writeShellApplication { - name = "eww-power"; - runtimeInputs = if useGivc then [ pkgs.givc-cli ] else [ pkgs.systemd ]; - bashOptions = [ ]; - text = '' - if [ $# -ne 1 ]; then - echo "Usage: $0 {reboot|poweroff|suspend}" - fi + mkPopupHandler = + { + name, + stateFile, + popupName, + }: + pkgs.writeShellApplication { + inherit name; + runtimeInputs = [ pkgs.inotify-tools ]; + # Needed to prevent script from exiting prematurely + bashOptions = [ ]; + text = '' + mkdir -p ~/.config/eww + echo 1 > ~/.config/eww/${stateFile} && sleep 0.5 + popup_timer_pid=0 - case "$1" in - reboot|poweroff) - ${if useGivc then "givc-cli ${cliArgs}" else "systemctl"} "$1" - ;; - suspend) - # Lock sessions - ${pkgs.systemd}/bin/loginctl lock-session + show_popup() { + if [ "$popup_timer_pid" -ne 0 ]; then + kill "$popup_timer_pid" 2>/dev/null + popup_timer_pid=0 + fi - # Switch off display before suspension - WAYLAND_DISPLAY=/run/user/${builtins.toString config.ghaf.users.accounts.uid}/wayland-0 ${pkgs.wlopm}/bin/wlopm --off '*' + if ! ${ewwCmd} active-windows | grep -q "${popupName}"; then + ${ewwCmd} open ${popupName} + ${ewwCmd} update ${popupName}-visible="true" + fi + ( + sleep 2 + ${ewwCmd} update ${popupName}-visible="false" + sleep 0.1 + ${ewwCmd} close ${popupName} + ) & - # Send suspend command to host - ${if useGivc then "${pkgs.givc-cli}/bin/givc-cli ${cliArgs}" else "systemctl"} suspend + popup_timer_pid=$! + } - # Switch on display on wakeup - WAYLAND_DISPLAY=/run/user/${builtins.toString config.ghaf.users.accounts.uid}/wayland-0 ${pkgs.wlopm}/bin/wlopm --on '*' - ;; - *) - echo "Invalid argument: $1" - echo "Usage: $0 {reboot|poweroff|suspend}" - ;; - esac - ''; - }; + inotifywait -m -e close_write ~/.config/eww/${stateFile} | + while read -r; do + show_popup > /dev/null 2>&1 + done + ''; + }; in { config = lib.mkIf cfg.enable { @@ -538,7 +469,7 @@ in :level { volume.muted == "true" ? "0" : volume.level } :onchange "PULSE_SERVER=audio-vm:${toString pulseaudioTcpControlPort} ${pkgs.pamixer}/bin/pamixer --unmute --set-volume {} &") (sys_slider - :header "Display" + :header "Brightness" :level {brightness.screen.level} :icon {brightness.icon} :min "5" @@ -593,19 +524,14 @@ in :space-evenly "false" (widget_button :class "power-menu-button" - :icon "${power-icon}" - :title "Shutdown" - :onclick "''${EWW_CMD} close power-menu closer & ${eww-power}/bin/eww-power poweroff &") + :icon "${lock-icon}" + :title "Lock" + :onclick "''${EWW_CMD} close power-menu closer & loginctl lock-session &") (widget_button :class "power-menu-button" :icon "${suspend-icon}" :title "Suspend" - :onclick "''${EWW_CMD} close power-menu closer & ${eww-power}/bin/eww-power suspend &") - (widget_button - :class "power-menu-button" - :icon "${restart-icon}" - :title "Reboot" - :onclick "''${EWW_CMD} close power-menu closer & ${eww-power}/bin/eww-power reboot &") + :onclick "''${EWW_CMD} close power-menu closer & ${ghaf-powercontrol}/bin/ghaf-powercontrol suspend &") (widget_button :class "power-menu-button" :icon "${logout-icon}" @@ -613,9 +539,14 @@ in :onclick "''${EWW_CMD} close power-menu closer & ${pkgs.labwc}/bin/labwc --exit &") (widget_button :class "power-menu-button" - :icon "${lock-icon}" - :title "Lock" - :onclick "''${EWW_CMD} close power-menu closer & loginctl lock-session &"))) + :icon "${restart-icon}" + :title "Reboot" + :onclick "''${EWW_CMD} close power-menu closer & ${ghaf-powercontrol}/bin/ghaf-powercontrol reboot &") + (widget_button + :class "power-menu-button" + :icon "${power-icon}" + :title "Shutdown" + :onclick "''${EWW_CMD} close power-menu closer & ${ghaf-powercontrol}/bin/ghaf-powercontrol poweroff &"))) ${lib.optionalString useGivc '' ;; Quick Settings Buttons ;; @@ -766,6 +697,7 @@ in :class "keyboard-layout" :halign "center" :valign "center" + :visible "false" (label :text keyboard_layout))) ;; Clock ;; @@ -839,7 +771,7 @@ in (language) (box :orientation "h" - :space-evenly "true" + :space-evenly "false" :spacing 14 (time) (date :screen screen)))) @@ -1390,5 +1322,41 @@ in startLimitIntervalSec = 0; after = [ "ewwbar.service" ]; }; + + systemd.user.services.eww-brightness-popup = { + enable = true; + serviceConfig = { + Type = "simple"; + ExecStart = "${ + mkPopupHandler { + name = "brightness-popup-handler"; + stateFile = "brightness"; + popupName = "brightness-popup"; + } + }/bin/brightness-popup-handler"; + Restart = "on-failure"; + }; + after = [ "ewwbar.service" ]; + wantedBy = [ "ewwbar.service" ]; + partOf = [ "ghaf-session.target" ]; + }; + + systemd.user.services.eww-volume-popup = { + enable = true; + serviceConfig = { + Type = "simple"; + ExecStart = "${ + mkPopupHandler { + name = "volume-popup-handler"; + stateFile = "volume"; + popupName = "volume-popup"; + } + }/bin/volume-popup-handler"; + Restart = "on-failure"; + }; + after = [ "ewwbar.service" ]; + wantedBy = [ "ewwbar.service" ]; + partOf = [ "ghaf-session.target" ]; + }; }; } diff --git a/modules/desktop/graphics/labwc.config.nix b/modules/desktop/graphics/labwc.config.nix index 2c0533e5d..1538e7818 100644 --- a/modules/desktop/graphics/labwc.config.nix +++ b/modules/desktop/graphics/labwc.config.nix @@ -10,11 +10,14 @@ let cfg = config.ghaf.graphics.labwc; ghaf-screenshot = pkgs.callPackage ../../../packages/ghaf-screenshot { }; + ghaf-powercontrol = pkgs.callPackage ../../../packages/ghaf-powercontrol { + ghafConfig = config.ghaf; + }; ghaf-workspace = pkgs.callPackage ../../../packages/ghaf-workspace { }; drawerStyle = pkgs.callPackage ./styles/launcher-style.nix { }; inherit (config.ghaf.services.audio) pulseaudioTcpControlPort; gtklockStyle = pkgs.callPackage ./styles/lock-style.nix { }; - lockCmd = "${pkgs.gtklock}/bin/gtklock -s ${gtklockStyle} -m ${pkgs.gtklock-userinfo-module}/lib/gtklock/userinfo-module.so"; + gtklockLayout = pkgs.callPackage ./styles/lock-layout.nix { }; autostart = pkgs.writeShellApplication { name = "labwc-autostart"; @@ -69,7 +72,11 @@ let 5 Ghaf + ${cfg.gtk.iconTheme} yes + + icon:iconify,max,close + ${cfg.gtk.fontName} 12 @@ -111,7 +118,7 @@ let - + ${lib.optionalString config.ghaf.profiles.debug.enable '' @@ -119,19 +126,19 @@ let ''} - + - + - + - + - + @@ -234,10 +241,53 @@ let default-timeout=5000 ignore-timeout=1 + [urgency=critical] + ignore-timeout=0 + [app-name=blueman body~="(.*Authorization request.*)"] invisible=1 ''; + gtklockConfig = '' + [main] + style=${gtklockStyle} + layout=${gtklockLayout} + date-format=%A, %b %d + modules=${pkgs.gtklock-powerbar-module}/lib/gtklock/powerbar-module.so;${pkgs.gtklock-userinfo-module}/lib/gtklock/userinfo-module.so + #background= + idle-timeout=30 + idle-hide=true + start-hidden=true + #follow-focus=true + #lock-command= + #unlock-command= + #monitor-priority= + [userinfo] + image-size=128 + under-clock=true + [powerbar] + #show-labels=true + #linked-buttons=true + reboot-command=${ghaf-powercontrol}/bin/ghaf-powercontrol reboot & + poweroff-command=${ghaf-powercontrol}/bin/ghaf-powercontrol poweroff & + suspend-command=${ghaf-powercontrol}/bin/ghaf-powercontrol suspend & + logout-command=${pkgs.labwc}/bin/labwc --exit & + #userswitch-command= + ''; + + swayidleConfig = '' + timeout ${ + toString (builtins.floor (cfg.autolock.duration * 0.8)) + } 'notify-send -u critical -t 10000 -i system "Automatic suspend" "The system will suspend soon due to inactivity."; brightnessctl -q -s; brightnessctl -q -m | { IFS=',' read -r _ _ _ brightness _ && [ "''${brightness%\%}" -le 25 ] || brightnessctl -q set 25% ;}' resume "brightnessctl -q -r || brightnessctl -q set 100%" + timeout ${toString cfg.autolock.duration} "loginctl lock-session" resume "brightnessctl -q -r || brightnessctl -q set 100%" + timeout ${ + toString (builtins.floor (cfg.autolock.duration * 1.5)) + } "wlopm --off \*" resume "wlopm --on \*" + timeout ${toString (builtins.floor (cfg.autolock.duration * 3))} "ghaf-powercontrol suspend" + after-resume "wlopm --on \*; brightnessctl -q -r || brightnessctl -q set 100%" + unlock "brightnessctl -q -r || brightnessctl -q set 100%" + ''; + environment = '' XCURSOR_THEME=Adwaita XCURSOR_SIZE=24 @@ -275,6 +325,10 @@ in "labwc/menu.xml".text = menuXml; "labwc/environment".text = environment; + "gtklock/config.ini".text = gtklockConfig; + + "swayidle/config".text = swayidleConfig; + "mako/config".text = makoConfig; "greetd/environments".text = lib.mkAfter "ghaf-session\n"; @@ -332,7 +386,7 @@ in description = "Lock Event Handler"; serviceConfig = { Type = "simple"; - ExecStart = "${pkgs.swayidle}/bin/swayidle lock \"${lockCmd}\""; + ExecStart = "${pkgs.swayidle}/bin/swayidle lock \"${pkgs.gtklock}/bin/gtklock -c /etc/gtklock/config.ini\""; }; partOf = [ "ghaf-session.target" ]; wantedBy = [ "ghaf-session.target" ]; @@ -348,9 +402,9 @@ in Environment = "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/tmp/dbusproxy_net.sock"; ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"; }; - wantedBy = [ "ghaf-session.target" ]; - partOf = [ "ghaf-session.target" ]; + wantedBy = [ "ewwbar.service" ]; after = [ "ewwbar.service" ]; + partOf = [ "ewwbar.service" ]; }; # We use existing blueman services and create overrides for both @@ -360,15 +414,14 @@ in Type = "simple"; Restart = "always"; RestartSec = "1"; - Environment = "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/tmp/bt_applet_ssh_system_dbus.sock"; ExecStart = [ "" "${pkgs.bt-launcher}/bin/bt-launcher applet" ]; }; - wantedBy = [ "ghaf-session.target" ]; - partOf = [ "ghaf-session.target" ]; + wantedBy = [ "ewwbar.service" ]; after = [ "ewwbar.service" ]; + partOf = [ "ewwbar.service" ]; }; blueman-manager = { @@ -378,26 +431,22 @@ in ]; }; - autolock = lib.mkIf cfg.autolock.enable { + swayidle = lib.mkIf cfg.autolock.enable { enable = true; - description = "System autolock"; + description = "System idle handler"; + path = [ + pkgs.brightnessctl + pkgs.systemd + pkgs.wlopm + ghaf-powercontrol + pkgs.libnotify + ]; serviceConfig = { Type = "simple"; - ExecStart = '' - ${pkgs.swayidle}/bin/swayidle -w timeout ${builtins.toString cfg.autolock.duration} \ - # Start dimming for 3.5 seconds in the background - '${pkgs.chayang}/bin/chayang -d 3.5 & CHAYANG_PID=$!; \ - sleep 3; \ - # If chayang is still running (i.e., user hasn't interrupted), - # proceed with locking - if kill -0 $CHAYANG_PID 2>/dev/null; then \ - loginctl lock-session; \ - fi' - ''; + ExecStart = "${pkgs.swayidle}/bin/swayidle -w -C /etc/swayidle/config"; }; partOf = [ "ghaf-session.target" ]; wantedBy = [ "ghaf-session.target" ]; - after = [ "ewwbar.service" ]; }; }; }; diff --git a/modules/desktop/graphics/styles/lock-layout.nix b/modules/desktop/graphics/styles/lock-layout.nix new file mode 100644 index 000000000..1ee3f4efd --- /dev/null +++ b/modules/desktop/graphics/styles/lock-layout.nix @@ -0,0 +1,137 @@ +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 + +# Ghaf lock screen layout +# Base layout taken from gtklock upstream: https://github.com/jovanlanik/gtklock/blob/master/res/gtklock.ui +{ + writeText, + ... +}: +writeText "gtklock.ui.xml" '' + + + + window-box + 100 + center + center + vertical + 30 + + + info-box + center + vertical + 10 + + + time-box + center + vertical + + + clock-label + center + + + + + date-label + center + + + + + + + + + crossfade + 0 + + + 30 + 5 + + + input-field + Password + 380 + 0 + 0 + password + view-reveal-symbolic + + + + + 1 + 0 + 2 + + + + + none + 1 + + + never + 256 + 1 + + + + + vertical + 1 + + + + + + + + + 1 + 1 + 2 + + + + + center + top + 15 + vertical + 0 + true + true + + + warning-label + true + true + + + + + error-label + true + true + + + + + 1 + 2 + 2 + + + + + + + + +'' diff --git a/modules/desktop/graphics/styles/lock-style.nix b/modules/desktop/graphics/styles/lock-style.nix index 17923d71e..829221dff 100644 --- a/modules/desktop/graphics/styles/lock-style.nix +++ b/modules/desktop/graphics/styles/lock-style.nix @@ -8,22 +8,93 @@ }: writeText "ghaf-lock.css" '' window { - background: rgba(18, 18, 18, 1); + background-color: #121212; color: #fff; } + + combobox button { + background: rgba(255, 255, 255, 0.1); + color: #fff; + } + + combobox button:focus { + background: rgba(255, 255, 255, 0.2); + color: #fff; + } + + combobox button:hover { + background: rgba(255, 255, 255, 0.2); + color: #fff; + } + + combobox window menu { + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; + } + button { box-shadow: none; - border-radius: 5px; border: none; - background: #171717; + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; + } + + button:focus { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); } + + button:hover { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + entry { - background-color: #232323; - border: 1px solid rgba(46, 46, 46, 1); + box-shadow: none; + border: none; + background: rgba(255, 255, 255, 0.1); color: #fff; + border-radius: 7px; } + entry:focus { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + entry:hover { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + #input-field { box-shadow: none; - border: 1px solid rgba(223, 92, 55, 1); + border: none; + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; + } + + #input-field:focus { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + #input-field:hover { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + #user-name { + margin-top: 15px; + font-weight: bold; + } + + #error-label { + color: #fff; + } + + #warning-label { + color: #fff; + } + + window.focused:not(.hidden) #time-box { + opacity: 0; } '' diff --git a/modules/desktop/graphics/styles/login-style.nix b/modules/desktop/graphics/styles/login-style.nix index 7ae6a1c12..5be830660 100644 --- a/modules/desktop/graphics/styles/login-style.nix +++ b/modules/desktop/graphics/styles/login-style.nix @@ -3,27 +3,82 @@ # Ghaf login screen style { - pkgs, + writeText, ... }: -pkgs.writeText "ghaf-login.css" '' +writeText "ghaf-login.css" '' window { - background: rgba(18, 18, 18, 1); + background-color: #121212; color: #fff; } + + combobox button { + background: rgba(255, 255, 255, 0.1); + color: #fff; + } + + combobox button:focus { + background: rgba(255, 255, 255, 0.2); + color: #fff; + } + + combobox button:hover { + background: rgba(255, 255, 255, 0.2); + color: #fff; + } + + combobox window menu { + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; + } + button { box-shadow: none; - border-radius: 5px; - border: 1px solid rgba(255, 255, 255, 0.09); - background: rgba(255, 255, 255, 0.06); + border: none; + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; + } + + button:focus { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); } + + button:hover { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + entry { - background-color: rgba (43, 43, 43, 1); - border: 1px solid rgba(46, 46, 46, 1); - color: #eee; + box-shadow: none; + border: none; + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; } + entry:focus { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + entry:hover { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + #input-field { box-shadow: none; - border: 1px solid rgba(223, 92, 55, 1); + border: none; + background: rgba(255, 255, 255, 0.1); + color: #fff; + border-radius: 7px; + } + + #input-field:focus { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); + } + + #input-field:hover { + box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.3); } + '' diff --git a/modules/desktop/graphics/waybar.config.nix b/modules/desktop/graphics/waybar.config.nix deleted file mode 100644 index 4d6a50619..000000000 --- a/modules/desktop/graphics/waybar.config.nix +++ /dev/null @@ -1,265 +0,0 @@ -# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors -# SPDX-License-Identifier: Apache-2.0 -{ - pkgs, - lib, - config, - ... -}: -let - cfg = config.ghaf.graphics.labwc; - inherit (config.ghaf.hardware.definition.network) pciDevices; - inherit (import ../../../lib/icons.nix { inherit pkgs lib; }) svgToPNG; - - launchpad-icon = svgToPNG "launchpad" "${pkgs.ghaf-artwork}/icons/launchpad.svg" "38x38"; - admin-icon = svgToPNG "admin" "${pkgs.ghaf-artwork}/icons/admin-cog.svg" "24x24"; - ghaf-icon = svgToPNG "ghaf-white" "${pkgs.ghaf-artwork}/icons/ghaf-white.svg" "24x24"; - - wifiDevice = lib.lists.findFirst (d: d.name != null) null pciDevices; - wifi-signal-strength = pkgs.callPackage ../../../packages/wifi-signal-strength { - wifiDevice = wifiDevice.name; - }; -in -{ - config = lib.mkIf cfg.enable { - ghaf.graphics.launchers = [ - { - name = "Terminal"; - description = "System Terminal"; - path = "${pkgs.foot}/bin/foot"; - } - ]; - environment.etc."waybar/config" = { - text = - # Modified from default waybar configuration file https://github.com/Alexays/Waybar/blob/master/resources/config - '' - { - "height": 48, // Waybar height - "spacing": 4, // Gaps between modules (4px) - "modules-left": ["custom/launchpad", "custom/ghaf-settings"], - "modules-center": ["sway/window"], - "position": "bottom", - "mode": "dock", - "spacing": 4, - "margin-top": 3, - "margin-bottom": 5, - "margin-left": 200, - "margin-right": 200, - "modules-right": ["pulseaudio", "custom/network1", "battery", "custom/admin", "clock", "tray"], - "keyboard-state": { - "numlock": true, - "capslock": true, - "format": "{name} {icon}", - "format-icons": { - "locked": "", - "unlocked": "" - } - }, - "tray": { - // "icon-size": 21, - "spacing": 10 - }, - "clock": { - "tooltip-format": "{:%d %b %Y}\n{calendar}", - "format": "{:%a %d %b %H:%M}" - }, - "backlight": { - // "device": "acpi_video1", - "format": "{percent}% {icon}", - "tooltip-format": "Brightness: {percent}%", - "format-icons": ["", "", "", "", "", "", "", "", ""] - }, - "battery": { - "states": { - "critical": 15 - }, - "interval": 5, - "format": "{capacity}% {icon}", - "format-charging": "{capacity}% 󰢟", - "format-plugged": "{capacity}% ", - "format-alt": "{time} {icon}", - "format-icons": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] - }, - '' - + lib.optionalString (wifiDevice != null) '' - "custom/network1": { - "format": "{}", - "interval": 15, - "exec": "${wifi-signal-strength}/bin/wifi-signal-strength", - "return-type": "json", - "on-click": "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/tmp/dbusproxy_net.sock ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator", - }, - '' - + '' - "custom/launchpad": { - "format": " ", - "on-click": "${pkgs.procps}/bin/pkill -USR1 nwg-drawer", - "tooltip": false - }, - "custom/ghaf-settings": { - "format": " ", - // Placeholder for the actual Ghaf settings app - "on-click": "${pkgs.libnotify}/bin/notify-send 'Ghaf Platform ${lib.strings.fileContents ../../../.version}'", - "tooltip": false - }, - "custom/admin": { - "format": " ", - "on-click": "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/tmp/dbusproxy_net.sock ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator", - "tooltip": false - }, - "pulseaudio": { - // "scroll-step": 1, // %, can be a float - "format": "{volume}% {icon} {format_source}", - "format-bluetooth": "{volume}% {icon} {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": "󰝟 {format_source}", - "format-source": "{volume}% ", - "format-source-muted": "", - "format-icons": { - "headphone": "", - "default": ["", "", ""] - }, - }, - }''; - - # The UNIX file mode bits - mode = "0644"; - }; - environment.etc."waybar/style.css" = { - text = - # Modified from default waybar style file https://github.com/Alexays/Waybar/blob/master/resources/style.css - '' - * { - font-family: FontAwesome, Inter, sans-serif; - font-size: 16px; - border-style: none; - border-radius: 4px; - } - - window#waybar { - background-color: rgba(18, 18, 18, 0.99); - color: #ffffff; - transition-property: background-color; - transition-duration: .5s; - } - - window#waybar.hidden { - } - - window#waybar.termite { - background-color: #3F3F3F; - } - - window#waybar.chromium { - background-color: #000000; - border: none; - } - - button { - box-shadow: inset 0 -3px transparent; - border: none; - border-radius: 0; - } - - button:hover { - background: inherit; - box-shadow: inset 0 -3px #ffffff; - } - - #workspaces button { - padding: 0 5px; - background-color: transparent; - color: #ffffff; - } - - #workspaces button:hover { - background: rgba(0, 0, 0, 0.2); - } - - #workspaces button.focused { - box-shadow: inset 0 -3px #ffffff; - } - - - #clock, - #battery, - #backlight, - #custom-network1, - #custom-launchpad, - #custom-ghaf-settings, - #custom-admin, - #pulseaudio, - #tray, - #window, - #workspaces { - padding: 0 20px; - } - - .modules-left > widget:first-child > #workspaces { - margin-left: 0; - } - - .modules-right > widget:last-child > #workspaces { - margin-right: 0; - } - - #pulseaudio, - #custom-network1, - #backlight, - #battery, - #clock { - padding-left: 10; - padding-right: 10; - } - - label:focus { - background-color: #000000; - } - - #tray > .passive { - -gtk-icon-effect: dim; - } - - #custom-launchpad { - font-size: 20px; - background-image: url("${launchpad-icon}"); - background-position: center; - background-repeat: no-repeat; - margin-left: 13px; - } - - #custom-ghaf-settings { - font-size: 20px; - background-image: url("${ghaf-icon}"); - background-position: center; - background-repeat: no-repeat; - padding-left: 10; - padding-right: 10; - } - - #custom-admin { - font-size: 20px; - background-image: url("${admin-icon}"); - background-position: center; - background-repeat: no-repeat; - padding-left: 10; - padding-right: 10; - } - ''; - - # The UNIX file mode bits - mode = "0644"; - }; - - systemd.user.services.waybar = { - enable = true; - description = "waybar menu"; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.waybar}/bin/waybar -s /etc/waybar/style.css -c /etc/waybar/config"; - }; - partOf = [ "ghaf-session.target" ]; - wantedBy = [ "ghaf-session.target" ]; - }; - }; -} diff --git a/overlays/custom-packages/default.nix b/overlays/custom-packages/default.nix index 9177ec449..1bd4f08a5 100644 --- a/overlays/custom-packages/default.nix +++ b/overlays/custom-packages/default.nix @@ -14,7 +14,6 @@ bt-launcher = final.callPackage ../../packages/bt-launcher { }; labwc = import ./labwc { inherit prev; }; tpm2-pkcs11 = import ./tpm2-pkcs11 { inherit prev; }; - waybar = import ./waybar { inherit prev; }; mitmweb-ui = final.callPackage ../../packages/mitmweb-ui { }; open-normal-extension = final.callPackage ../../packages/open-normal-extension { }; hardware-scan = final.callPackage ../../packages/hardware-scan { }; diff --git a/overlays/custom-packages/waybar/default.nix b/overlays/custom-packages/waybar/default.nix deleted file mode 100644 index d4445aded..000000000 --- a/overlays/custom-packages/waybar/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors -# SPDX-License-Identifier: Apache-2.0 -# -# This overlay customizes waybar -# -{ prev }: -(prev.waybar.override { - hyprlandSupport = false; - swaySupport = false; - jackSupport = false; - cavaSupport = false; - pulseSupport = false; -})