obxml,mb-brightness

This commit is contained in:
Daniel Napora 2023-05-18 16:06:23 +02:00
parent 34eaf6e7ed
commit a7d3e0a739
3 changed files with 80 additions and 13 deletions

17
bin/mb-brightness Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
## mb-brightness - control brightness on Mabox
CARD=$(ls /sys/class/backlight | head -n 1)
inc() {
[[ "$CARD" == *"intel_"* ]] && xbacklight -inc 10 || light -A 5
}
dec() {
[[ "$CARD" == *"intel_"* ]] && xbacklight -dec 10 || light -U 5
}
case "$1" in
inc)inc;;
dec)dec;;
esac

63
bin/obxml Executable file
View File

@ -0,0 +1,63 @@
#!/bin/bash
# helper script for editing Openbox rc.xml config file
nspace="http://openbox.org/3.4/rc"
rcxml="$HOME/.config/openbox/rc.xml"
reconf=0
sel(){
xml sel -N a="$nspace" -t -v ${1} "$rcxml"
}
set(){
xml ed -L -N a="$nspace" -u ${1} -v ${2} "$rcxml"
reconf=1
}
switch_desk(){
case "$1" in
on)
set '/a:openbox_config/a:mouse/a:context[@name="Root"]/a:mousebind[@action="Click"][@button="Up"]/a:action/a:to' previous
set '/a:openbox_config/a:mouse/a:context[@name="Root"]/a:mousebind[@action="Click"][@button="Down"]/a:action/a:to' next
;;
off)
set '/a:openbox_config/a:mouse/a:context[@name="Root"]/a:mousebind[@action="Click"][@button="Up"]/a:action/a:to' none
set '/a:openbox_config/a:mouse/a:context[@name="Root"]/a:mousebind[@action="Click"][@button="Down"]/a:action/a:to' none
;;
esac
}
show_desk(){
case "$1" in
on)
set '/a:openbox_config/a:mouse/a:context[@name="Root"]/a:mousebind[@action="Press"][@button="Left"]/a:action/@name' ToggleShowDesktop
;;
off)
set '/a:openbox_config/a:mouse/a:context[@name="Root"]/a:mousebind[@action="Press"][@button="Left"]/a:action/@name' none
;;
esac
}
focus_follow_mouse(){
case "$1" in
on)
set '/a:openbox_config/a:focus/a:followMouse' yes
set '/a:openbox_config/a:focus/a:raiseOnFocus' yes
;;
off)
set '/a:openbox_config/a:focus/a:followMouse' no
set '/a:openbox_config/a:focus/a:raiseOnFocus' no
;;
esac
}
case "$1" in
sel)sel "$2";;
set)set "$2" "$3";;
switch_desk)switch_desk "$2";;
show_desk)show_desk "$2";;
focus_follow_mouse)focus_follow_mouse "$2";;
esac
[[ "$reconf" = "1" ]] && openbox --reconfigure

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
reload-gtk
killall conky
sleep 1
wallp="$(< "${HOME}/.cache/wal/wal")"
cp "$HOME/.config/wpg/samples/${wallp##*/}_wal_sample.png" "$HOME/.config/conky/images/colors-colorize.png"
nitrogen --set-scaled ${wallp} --save
mb-conky-session --autostart
#echo ${wallp##*/}