fix: hide detailed text of MonitorItem immediatly after hovering and changing the value & specify device for brightnessctl
This commit is contained in:
6
.scripts/set-brightness
Executable file
6
.scripts/set-brightness
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ -z "$1" ] && exit 1
|
||||||
|
[ -z "$BRIGHTNESSCTL_DEVICE" ] && BRIGHTNESSCTL_DEVICE="auto"
|
||||||
|
|
||||||
|
brightnessctl -d "$BRIGHTNESSCTL_DEVICE" set "$1"
|
||||||
@@ -23,8 +23,17 @@ for link in /dev/dri/by-path/*-card; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# AQ_DRM_DEVICES allow multiple entries separated by colon
|
# Specify device for brightnessctl
|
||||||
# Set it according to preference order
|
# Only tested on my laptop with Intel iGPU & Nvidia dGPU
|
||||||
|
BRIGHTNESSCTL_DEVICE="auto"
|
||||||
|
if [[ -n "$intel_path" ]]; then
|
||||||
|
BRIGHTNESSCTL_DEVICE="intel_backlight"
|
||||||
|
elif [[ -n "$nvidia_path" ]]; then
|
||||||
|
BRIGHTNESSCTL_DEVICE="nvidia_0"
|
||||||
|
fi
|
||||||
|
export BRIGHTNESSCTL_DEVICE
|
||||||
|
|
||||||
|
# AQ_DRM_DEVICES allows multiple entries separated by colon
|
||||||
devices=""
|
devices=""
|
||||||
for who in "${prefer_order[@]}"; do
|
for who in "${prefer_order[@]}"; do
|
||||||
case "$who" in
|
case "$who" in
|
||||||
@@ -48,11 +57,11 @@ done
|
|||||||
|
|
||||||
# Update niri config
|
# Update niri config
|
||||||
for file in "$HOME/.config/niri/config.kdl" "$HOME/.config/niri/config.kdl.template"; do
|
for file in "$HOME/.config/niri/config.kdl" "$HOME/.config/niri/config.kdl.template"; do
|
||||||
[[ -f "$file" ]] || return 0
|
[[ -f "$file" ]] || continue
|
||||||
|
|
||||||
if grep -qE '^\s*render-drm-device\s+"[^"]+"' "$file"; then
|
if grep -qE '^\s*render-drm-device\s+"[^"]+"' "$file"; then
|
||||||
current="$(grep -E '^\s*render-drm-device\s+"[^"]+"' "$file" | sed -E 's/^\s*render-drm-device\s+"([^"]+)".*/\1/')"
|
current="$(grep -E '^\s*render-drm-device\s+"[^"]+"' "$file" | sed -E 's/^\s*render-drm-device\s+"([^"]+)".*/\1/')"
|
||||||
[[ "$current" == "$primary_device" ]] && return 0
|
[[ "$current" == "$primary_device" ]] && continue
|
||||||
sed -i -E "s|^(\s*render-drm-device\s+)\"[^\"]+\"|\1\"$primary_device\"|" "$file"
|
sed -i -E "s|^(\s*render-drm-device\s+)\"[^\"]+\"|\1\"$primary_device\"|" "$file"
|
||||||
else
|
else
|
||||||
printf '\ndebug {\nrender-drm-device "%s"\n}\n' "$primary_device" >> "$file"
|
printf '\ndebug {\nrender-drm-device "%s"\n}\n' "$primary_device" >> "$file"
|
||||||
|
|||||||
@@ -322,8 +322,8 @@ binds {
|
|||||||
XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; }
|
XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; }
|
||||||
|
|
||||||
// Brightness
|
// Brightness
|
||||||
XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; }
|
XF86MonBrightnessUp allow-when-locked=true { spawn "set-brightness" "+10%"; }
|
||||||
XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; }
|
XF86MonBrightnessDown allow-when-locked=true { spawn "set-brightness" "10%-"; }
|
||||||
|
|
||||||
// Window management
|
// Window management
|
||||||
Mod+Tab repeat=false { toggle-overview; }
|
Mod+Tab repeat=false { toggle-overview; }
|
||||||
|
|||||||
@@ -322,8 +322,8 @@ binds {
|
|||||||
XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; }
|
XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; }
|
||||||
|
|
||||||
// Brightness
|
// Brightness
|
||||||
XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; }
|
XF86MonBrightnessUp allow-when-locked=true { spawn "set-brightness" "+10%"; }
|
||||||
XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; }
|
XF86MonBrightnessDown allow-when-locked=true { spawn "set-brightness" "10%-"; }
|
||||||
|
|
||||||
// Window management
|
// Window management
|
||||||
Mod+Tab repeat=false { toggle-overview; }
|
Mod+Tab repeat=false { toggle-overview; }
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ Item {
|
|||||||
property real hideTimeOut: 2000 // ms
|
property real hideTimeOut: 2000 // ms
|
||||||
property bool forceExpand: false
|
property bool forceExpand: false
|
||||||
property bool _expand: forceExpand || mouseArea.containsMouse
|
property bool _expand: forceExpand || mouseArea.containsMouse
|
||||||
|
property bool _isFirst: true
|
||||||
property bool disableHover: false
|
property bool disableHover: false
|
||||||
property bool critical: false
|
property bool critical: false
|
||||||
property color criticalColor: Colors.red
|
property color criticalColor: Colors.red
|
||||||
@@ -39,6 +40,15 @@ Item {
|
|||||||
|
|
||||||
sourceComponent: Connections {
|
sourceComponent: Connections {
|
||||||
function onValueChanged() {
|
function onValueChanged() {
|
||||||
|
// No need to expand (again) if already hovering
|
||||||
|
if (mouseArea.containsMouse)
|
||||||
|
return ;
|
||||||
|
|
||||||
|
// Skip first change (which is most likely initialization)
|
||||||
|
if (root._isFirst) {
|
||||||
|
root._isFirst = false;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
root.forceExpand = true;
|
root.forceExpand = true;
|
||||||
hideTimer.restart();
|
hideTimer.restart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ Singleton {
|
|||||||
Quickshell.execDetached(["ddcutil", "-b", busNum, "setvcp", "10", rounded])
|
Quickshell.execDetached(["ddcutil", "-b", busNum, "setvcp", "10", rounded])
|
||||||
} else {
|
} else {
|
||||||
monitor.ignoreNextChange = true
|
monitor.ignoreNextChange = true
|
||||||
Quickshell.execDetached(["brightnessctl", "s", rounded + "%"])
|
Quickshell.execDetached(["set-brightness", rounded + "%"])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDdc) {
|
if (isDdc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user