From 7e5dba2118e4ffe0aeec1fd3fe7e85d2424d4e9e Mon Sep 17 00:00:00 2001 From: Uyanide Date: Tue, 23 Dec 2025 22:13:04 +0100 Subject: [PATCH] qs: a new action --- .../Modules/Bar/Components/FocusedWindow.qml | 4 +- config/scripts/.local/snippets/set_display | 76 +++++++++++-------- config/wallpaper/Pictures/backgrounds | 2 +- 3 files changed, 47 insertions(+), 35 deletions(-) diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Components/FocusedWindow.qml b/config/quickshell/.config/quickshell/Modules/Bar/Components/FocusedWindow.qml index d91bde1..01643ea 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Components/FocusedWindow.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Components/FocusedWindow.qml @@ -85,7 +85,7 @@ Item { anchors.fill: parent cursorShape: Qt.PointingHandCursor hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.MiddleButton + acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton onEntered: { if (windowTitle.implicitWidth > titleContainer.width) windowTitle.x = titleContainer.width - windowTitle.implicitWidth; @@ -99,6 +99,8 @@ Item { Quickshell.execDetached(["niri", "msg", "action", "close-window"]); else if (mouse.button === Qt.LeftButton) Quickshell.execDetached(["niri", "msg", "action", "center-window"]); + else if (mouse.button === Qt.RightButton) + Quickshell.execDetached(["niri", "msg", "action", "maximize-window-to-edges"]); } onWheel: function(wheel) { if (wheel.angleDelta.y > 0) diff --git a/config/scripts/.local/snippets/set_display b/config/scripts/.local/snippets/set_display index 49168c9..5ec1c88 100644 --- a/config/scripts/.local/snippets/set_display +++ b/config/scripts/.local/snippets/set_display @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Description: -# Select which GPU to use for rendering for Hyprland and Niri. +# Select which GPU to use for rendering by Hyprland and Niri. # -# envs exported: -# HYPR_AQ_DRM_DEVICES - Colon-separated list of DRM device paths for Hyprland's aq_drm +# Envs exported: +# HYPR_AQ_DRM_DEVICES - Colon-separated list of DRM device paths for Hyprland's AQ_DRM_DEVICES env # BRIGHTNESSCTL_DEVICE - Device identifier for brightnessctl # Constants @@ -19,36 +19,36 @@ nvidia_path="" amd_path="" for link in /dev/dri/by-path/*-card; do - [[ -e "$link" ]] || continue - card="$(readlink -f "$link")" - vfile="/sys/class/drm/$(basename "$card")/device/vendor" - [[ -r "$vfile" ]] || continue - vendor="$(cat "$vfile")" - case "$vendor" in + [[ -e "$link" ]] || continue + card="$(readlink -f "$link")" + vfile="/sys/class/drm/$(basename "$card")/device/vendor" + [[ -r "$vfile" ]] || continue + vendor="$(cat "$vfile")" + case "$vendor" in 0x10de) nvidia_path="$card" ;; 0x8086) intel_path="$card" ;; 0x1002) amd_path="$card" ;; - esac + esac done # Specify device for brightnessctl # Only tested on my laptop with Intel iGPU & Nvidia dGPU BRIGHTNESSCTL_DEVICE="auto" if [[ -n "$intel_path" ]]; then - BRIGHTNESSCTL_DEVICE="intel_backlight" + BRIGHTNESSCTL_DEVICE="intel_backlight" elif [[ -n "$nvidia_path" ]]; then - BRIGHTNESSCTL_DEVICE="nvidia_0" + BRIGHTNESSCTL_DEVICE="nvidia_0" fi export BRIGHTNESSCTL_DEVICE # AQ_DRM_DEVICES allows multiple entries separated by colon devices="" for who in "${prefer_order[@]}"; do - case "$who" in + case "$who" in nvidia) [[ -n "$nvidia_path" ]] && devices="${devices:+$devices:}$nvidia_path" ;; - intel) [[ -n "$intel_path" ]] && devices="${devices:+$devices:}$intel_path" ;; - amd) [[ -n "$amd_path" ]] && devices="${devices:+$devices:}$amd_path" ;; - esac + intel) [[ -n "$intel_path" ]] && devices="${devices:+$devices:}$intel_path" ;; + amd) [[ -n "$amd_path" ]] && devices="${devices:+$devices:}$amd_path" ;; + esac done HYPR_AQ_DRM_DEVICES="${devices:-$default_dri_path}" export HYPR_AQ_DRM_DEVICES @@ -56,28 +56,38 @@ export HYPR_AQ_DRM_DEVICES # But niri only supports choosing one preferred render device primary_device="$default_dri_path" for who in "${prefer_order[@]}"; do - case "$who" in - nvidia) [[ -n "$nvidia_path" ]] && { primary_device="$nvidia_path"; break; } ;; - intel) [[ -n "$intel_path" ]] && { primary_device="$intel_path"; break; } ;; - amd) [[ -n "$amd_path" ]] && { primary_device="$amd_path"; break; } ;; - esac + case "$who" in + nvidia) [[ -n "$nvidia_path" ]] && { + primary_device="$nvidia_path" + break + } ;; + intel) [[ -n "$intel_path" ]] && { + primary_device="$intel_path" + break + } ;; + amd) [[ -n "$amd_path" ]] && { + primary_device="$amd_path" + break + } ;; + esac done # Update niri config function update_niri_config() { - local config_file="$1" - local device_path="$2" + local config_file="$1" + local device_path="$2" - [[ -f "$config_file" ]] || return + [[ -f "$config_file" ]] || return - if grep -qE '^\s*render-drm-device\s+"[^"]+"' "$config_file"; then - local current - current="$(grep -E '^\s*render-drm-device\s+"[^"]+"' "$config_file" | sed -E 's/^\s*render-drm-device\s+"([^"]+)".*/\1/')" - [[ "$current" == "$device_path" ]] && return - sed -i -E "s|^(\s*render-drm-device\s+)\"[^\"]+\"|\1\"$device_path\"|" "$config_file" - else - printf '\ndebug {\nrender-drm-device "%s"\n}\n' "$device_path" >> "$config_file" - fi + if grep -qE '^\s*render-drm-device\s+"[^"]+"' "$config_file"; then + local current + current="$(grep -E '^\s*render-drm-device\s+"[^"]+"' "$config_file" | sed -E 's/^\s*render-drm-device\s+"([^"]+)".*/\1/')" + [[ "$current" == "$device_path" ]] && return + sed -i -E "s|^(\s*render-drm-device\s+)\"[^\"]+\"|\1\"$device_path\"|" "$config_file" + else + printf '\ndebug {\nrender-drm-device "%s"\n}\n' "$device_path" >>"$config_file" + fi } -update_niri_config "$niri_config_file" "$primary_device" \ No newline at end of file +update_niri_config "$niri_config_file" "$primary_device" + diff --git a/config/wallpaper/Pictures/backgrounds b/config/wallpaper/Pictures/backgrounds index 984d33f..503ff8b 160000 --- a/config/wallpaper/Pictures/backgrounds +++ b/config/wallpaper/Pictures/backgrounds @@ -1 +1 @@ -Subproject commit 984d33f2c5ff3b934c8224bfa6b848211f6b5b1c +Subproject commit 503ff8b986e64409bdb118c73316d0b739fe5296