Brightness script fix/Not using XF86 keys in SXHKD

This commit is contained in:
agryphus 2023-10-26 11:14:52 -04:00
parent c061646f9b
commit 970806080d
3 changed files with 38 additions and 13 deletions

View file

@ -113,6 +113,14 @@
}; };
# Misc services # Misc services
services.udev = {
# Allows member of the "video" group to change system backlight
extraRules = ''
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video %S%p/brightness", RUN+="${pkgs.coreutils}/bin/chmod g+w %S%p/brightness"
'';
path = [ pkgs.coreutils ]; # For chgrp
};
services.autorandr.enable = true;
services.udisks2.enable = true; # USB Mounting services.udisks2.enable = true; # USB Mounting
# services.printing.enable = true; # CUPS # services.printing.enable = true; # CUPS
@ -155,11 +163,13 @@
killall # Easy way to kill a process killall # Easy way to kill a process
libnotify # Send messages to notification daemon libnotify # Send messages to notification daemon
libreoffice # MSOffice btfo libreoffice # MSOffice btfo
maim # Screenshot utility
neofetch # Aesthetic sysinfo neofetch # Aesthetic sysinfo
pass-nodmenu # CLI password store (without dmenu dependency) pass-nodmenu # CLI password store (without dmenu dependency)
picom # X Compositor picom # X Compositor
pinentry-curses # Terminal-based pinentry program pinentry-curses # Terminal-based pinentry program
pinentry-rofi # Rofi frontend for pinentry program pinentry-rofi # Rofi frontend for pinentry program
python311 # Python
rofi # Menu prompt program rofi # Menu prompt program
rofi-pass # Rofi frontend for password store rofi-pass # Rofi frontend for password store
st # Suckless terminal st # Suckless terminal
@ -200,6 +210,7 @@
perl536Packages.FileMimeInfo # Provides mimeopen, to ask what program to open files in perl536Packages.FileMimeInfo # Provides mimeopen, to ask what program to open files in
poppler_utils # Provides pdftoppm, to turn pdfs into images poppler_utils # Provides pdftoppm, to turn pdfs into images
ueberzugpp # Terminal image overlayer ueberzugpp # Terminal image overlayer
unrar-wrapper # Extract .rar files
xclip # Copy file name to clip xclip # Copy file name to clip
zathura # PDF viewer zathura # PDF viewer
@ -208,9 +219,10 @@
xclip xclip
# Silly programs # Silly programs
sl # Choo choo
asciiquarium # Good to throw on an extra monitor asciiquarium # Good to throw on an extra monitor
bsdgames # Fun collection of command-line games
neo-cowsay # The cow says moo neo-cowsay # The cow says moo
sl # Choo choo
# Some nix specific stuff # Some nix specific stuff
nix-index nix-index
@ -258,8 +270,6 @@
nix-shell -p ${make-shell} --run "make $*" nix-shell -p ${make-shell} --run "make $*"
'') '')
) )
]; ];
#nixpkgs.overlays = [ #nixpkgs.overlays = [

View file

@ -30,10 +30,16 @@ super + e
# Implementing basic control hotkeys # Implementing basic control hotkeys
super + l super + l
xsecurelock xsecurelock
super + Print # Print
dmenu -p "Screenshot filename:" < /dev/null | xargs -I "name" maim -s ~/name F10
super + shift + Print rofi -dmenu -l 0 -p "Screenshot filename" < /dev/null | xargs -I "name" maim -s ~/name
dmenu -p "Screenshot filename:" < /dev/null | xargs -I "name" maim ~/name # shift + Print
shift + F10
rofi -dmenu -l 0 -p "Screenshot filename" < /dev/null | xargs -I "name" maim ~/name
super + p
rofi -dmenu -l 0 -p "Screenshot filename" < /dev/null | xargs -I "name" maim -s ~/name
super + P
rofi -dmenu -l 0 -p "Screenshot filename" < /dev/null | xargs -I "name" maim ~/name
super + minus super + minus
wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-; notify-send -r 44 "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-; notify-send -r 44 "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
super + shift + minus super + shift + minus
@ -42,8 +48,10 @@ super + equal
wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+; notify-send -r 44 "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+; notify-send -r 44 "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
super + shift + equal super + shift + equal
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; notify-send -r 44 "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; notify-send -r 44 "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
XF86MonBrightnessUp # XF86MonBrightnessUp
F7
change-brightness up change-brightness up
XF86MonBrightnessDown # XF86MonBrightnessDown
F6
change-brightness down change-brightness down

View file

@ -1,7 +1,14 @@
#!/bin/sh #!/usr/bin/env sh
# Simple script to change the system backlight. Requires a udev rules that gives the user permission
# to the backlight folder.
# $ change-brightness up # Increases brightness
# $ change-brightness down # Decreases brightness
max_brightness=`cat /sys/class/backlight/intel_backlight/max_brightness` kernel="$(ls /sys/class/backlight/ | head -n 1)"
brightness=`cat /sys/class/backlight/intel_backlight/brightness` dir="/sys/class/backlight/$kernel"
max_brightness="$(cat $dir/max_brightness)"
brightness="$(cat $dir/brightness)"
increment=12000 increment=12000
if [ "$1" = "down" ]; then if [ "$1" = "down" ]; then
@ -16,7 +23,7 @@ else
fi fi
fi fi
echo $new_brightness > /sys/class/backlight/intel_backlight/brightness echo $new_brightness > $dir/brightness
ratio=$(( (new_brightness * 100) / max_brightness )) ratio=$(( (new_brightness * 100) / max_brightness ))
notify-send -r 43 "Brightness: ${ratio}%" notify-send -r 43 "Brightness: ${ratio}%"