[~] Refactor

This commit is contained in:
Siarhei Siniak 2023-01-25 16:29:00 +03:00
parent 61c29b8421
commit 935e9a8faf
5 changed files with 58 additions and 0 deletions

6
d1/f1-root.sh Normal file

@ -0,0 +1,6 @@
#!/bin/sh
echo user;
whoami
echo udev rules;
sudo cp dotfiles/etc/udev/rules.d/40-leds.rules /etc/udev/rules.d/40-leds.rules

@ -1200,9 +1200,56 @@ def desktop_services(argv):
type=int, type=int,
help='0 - mac book air (no turbo boost, max pct 30, every 4 seconds', help='0 - mac book air (no turbo boost, max pct 30, every 4 seconds',
) )
parser.add_option(
'--backlight-increase',
dest='backlight_increase',
default=False,
action='store_true',
help='increase keyboard backlight',
)
parser.add_option(
'--backlight-decrease',
dest='backlight_decrease',
default=False,
action='store_true',
help='decrease keyboard backlight',
)
options, args = parser.parse_args(argv) options, args = parser.parse_args(argv)
if options.backlight_increase or options.backlight_decrease:
if sys.platform == 'linux':
leds = \
[
o.strip()
for o in subprocess.check_output(['light', '-L'])\
.decode('utf-8')\
.splitlines()[1:]
]
if 'sysfs/leds/smc::kbd_backlight' in leds:
extra_args = []
if options.backlight_increase:
extra_args.extend(['-A', '20'])
elif options.backlight_decrease:
extra_args.extend(['-U', '20'])
else:
raise NotImplementedError
subprocess.check_call([
'light', '-v', '3',
'-s', 'sysfs/leds/smc::kbd_backlight',
*extra_args,
])
else:
raise NotImplementedError
else:
raise NotImplementedError
return
else:
pass
os.environ['SWAYSOCK'] = sway_sock() os.environ['SWAYSOCK'] = sway_sock()
assert all([ assert all([

@ -73,6 +73,9 @@ input type:touchpad {
# #
bindsym $mod+Shift+l exec loginctl list-sessions | tail '-n' +2 | head -n -2 | awk '{print $1}' | xargs loginctl lock-session bindsym $mod+Shift+l exec loginctl list-sessions | tail '-n' +2 | head -n -2 | awk '{print $1}' | xargs loginctl lock-session
bindsym XF86KbdBrightnessDown exec bash -c "commands desktop-services --backlight-decrease"
bindsym XF86KbdBrightnessUp exec bash -c "commands desktop-services --backlight-increase"
# Start a terminal # Start a terminal
bindsym $mod+t exec $term bindsym $mod+t exec $term

@ -0,0 +1 @@
yay -S light

@ -1 +1,2 @@
ACTION=="add|change", SUBSYSTEM=="leds", DEVPATH=="/devices/pci0000:00/0000:00:1b.0/hdaudioC0D0/leds/hda::mute", RUN{program}+="/usr/bin/chmod 666 /sys$devpath/brightness" ACTION=="add|change", SUBSYSTEM=="leds", DEVPATH=="/devices/pci0000:00/0000:00:1b.0/hdaudioC0D0/leds/hda::mute", RUN{program}+="/usr/bin/chmod 666 /sys$devpath/brightness"
ACTION=="add|change", SUBSYSTEM=="leds", DEVPATH=="/devices/platform/applesmc.768/leds/smc::kbd_backlight", RUN{program}+="/usr/bin/chmod 666 /sys$devpath/brightness"