Sway support removed. Moved I38 specific scripts out of the branch covered by dex.
This commit is contained in:
1 parent
45eb3ae4fc
commit
3a9c2ab6f1
13 files changed
+147
-449
No files matched your search
@@ -10,24 +10,12 @@
|
||||
|
||||
# You should have received a copy of the GNU General Public License along with I38. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Not for multiple screens.
|
||||
# Detect if we're on Wayland or X11
|
||||
if [[ -n "${WAYLAND_DISPLAY}" ]]; then
|
||||
# Sway/Wayland: Get the name of the first output
|
||||
screenName="$(swaymsg -t get_outputs | jq -r '.[0].name')"
|
||||
if [[ -z "$screenName" ]]; then
|
||||
notify-send "Error: Could not detect output"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# i3/X11: Get the name of the screen
|
||||
if ! command -v xrandr &> /dev/null; then
|
||||
notify-send "Error: xrandr not found"
|
||||
exit 1
|
||||
fi
|
||||
screenName="$(xrandr --query | grep "connected" | cut -d ' ' -f1 | head -n 1)"
|
||||
if ! command -v xrandr &> /dev/null; then
|
||||
notify-send "Error: xrandr not found"
|
||||
exit 1
|
||||
fi
|
||||
screenName="$(xrandr --query | grep "connected" | cut -d ' ' -f1 | head -n 1)"
|
||||
|
||||
menuOptions=(
|
||||
"1.0" "Maximum Brightness"
|
||||
@@ -43,28 +31,7 @@ if [[ ${#brightness} -lt 1 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Apply brightness setting
|
||||
if [[ -n "${WAYLAND_DISPLAY}" ]]; then
|
||||
# Sway: Use swaymsg to set output brightness
|
||||
# Note: Sway doesn't have native brightness control, using wlr-randr if available
|
||||
if command -v wlr-randr &> /dev/null; then
|
||||
wlr-randr --output "${screenName}" --brightness "${brightness%%|*}" &&
|
||||
spd-say -P important -Cw "Screen set to ${brightness#*|}."
|
||||
else
|
||||
# Fallback to gamma adjustment via wl-gammactl or brightnessctl
|
||||
if command -v brightnessctl &> /dev/null; then
|
||||
brightnessValue=$(echo "${brightness%%|*} * 100" | bc)
|
||||
brightnessctl set "${brightnessValue%.*}%" &&
|
||||
spd-say -P important -Cw "Screen set to ${brightness#*|}."
|
||||
else
|
||||
notify-send "Error: wlr-randr or brightnessctl required for Sway brightness control"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# i3: Use xrandr
|
||||
xrandr --output "${screenName}" --brightness "${brightness%%|*}" &&
|
||||
spd-say -P important -Cw "Screen set to ${brightness#*|}."
|
||||
fi
|
||||
xrandr --output "${screenName}" --brightness "${brightness%%|*}" &&
|
||||
spd-say -P important -Cw "Screen set to ${brightness#*|}."
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user