[~] Refactor
This commit is contained in:
parent
61c29b8421
commit
935e9a8faf
6
d1/f1-root.sh
Normal file
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,
|
||||
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)
|
||||
|
||||
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()
|
||||
|
||||
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 XF86KbdBrightnessDown exec bash -c "commands desktop-services --backlight-decrease"
|
||||
bindsym XF86KbdBrightnessUp exec bash -c "commands desktop-services --backlight-increase"
|
||||
|
||||
# Start a terminal
|
||||
bindsym $mod+t exec $term
|
||||
|
||||
|
1
dotfiles/etc/archlinux/packages.sh
Normal file
1
dotfiles/etc/archlinux/packages.sh
Normal file
@ -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/platform/applesmc.768/leds/smc::kbd_backlight", RUN{program}+="/usr/bin/chmod 666 /sys$devpath/brightness"
|
||||
|
Loading…
Reference in New Issue
Block a user