Screen brightness script added.

This commit is contained in:
Storm Dragon 2023-08-29 16:14:11 -04:00
parent ea7450bb8b
commit 4773bdae87
3 changed files with 29 additions and 0 deletions

View File

@ -30,6 +30,7 @@ An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](ht
- transfersh: [optional] for file sharing GUI
- udiskie: [optional] for automatically mounting removable storage
- xclip: Clipboard support
- xbacklight: [optional] for screen brightness adjustment
- yad: For screen reader accessible dialogs
I38 will try to detect your browser, file manager, and web browser and present you with a list of options to bind to their launch keys. It will also create bindings for pidgin and mumble if they are installed. To use the bindings, press your ratpoison mode key which is set when you run the i38.sh script. next, press the binding for the application you want, w for web browser, e for text editor, f for file manager, m for mumble, etc. To learn all the bindings, find and read the mode ratpoison section of ~/.config/i3/config.

4
i38.sh
View File

@ -415,6 +415,10 @@ $(if command -v pidgin &> /dev/null ; then
echo "# p bound to pidgin"
echo "bindsym p exec $(command -v pidgin), mode \"default\""
fi)
$(if command -v xrandr &> /dev/null ; then
echo "# alt+s bound to brightness control"
echo "bindsym \$mod+s exec --no-startup-id ${i3Path}/scripts/screen_controller.sh"
fi)
$(if command -v transfersh &> /dev/null ; then
echo "# t bound to share file with transfer.sh"
echo 'bindsym t exec bash -c '"'"'fileName="$(yad --title "I38 Upload File" --file)" && url="$(transfersh "${fileName}" | tee >(yad --title "I38 - Uploading ${fileName##*/} ..." --progress --pulsate --auto-close))" && echo "${url#*saved at: }" | tee >(yad --title "I38 - Upload URL" --show-cursor --show-uri --button yad-close --sticky --text-info) >(xclip -selection clipboard)'"', mode \"default\""

24
scripts/screen_controller.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Not for multiple screens.
# Get the name of the screen.
screenName="$(xrandr --query | grep "connected" | cut -d ' ' -f1 | head -n 1)"
menuOptions=(
"1.0" "Maximum Brightness"
"0.75" "75 percent"
"0.5" "50 percent"
"0.25" "25 percent"
"0" "Screen Curtain"
)
brightness="$(yad --list --title "I38" --text "Set Screen Brightness" --columns 2 --hide-column 1 --column "" --column "Select" "${menuOptions[@]}")"
if [[ ${#brightness} -lt 1 ]]; then
exit 0
fi
xrandr --output ${screenName} --brightness ${brightness%%|*} &&
spd-say -P important -Cw "Screen set to ${brightness##*|}."
exit 0