Minor style cleanups in userscripts implementation
This commit is contained in:
parent
933ef2b736
commit
e23f439b65
2 changed files with 67 additions and 44 deletions
|
@ -7,25 +7,40 @@ programchoicesinit() {
|
||||||
|
|
||||||
# Default system menu (no matches)
|
# Default system menu (no matches)
|
||||||
CHOICES="$(echo "
|
CHOICES="$(echo "
|
||||||
Scripts ^ 0 ^ sxmo_appmenu.sh scripts
|
$(
|
||||||
Apps ^ 0 ^ sxmo_appmenu.sh applications
|
[ -n "$(ls -A $XDG_CONFIG_HOME/sxmo/userscripts)" ] &&
|
||||||
$([ -d $XDG_CONFIG_HOME/sxmo/userscripts ] && [ -n "$(ls -A $XDG_CONFIG_HOME/sxmo/userscripts)" ] && echo 'Userscripts ^ 0 ^ sxmo_appmenu.sh userscripts')
|
echo 'Userscripts ^ 0 ^ sxmo_appmenu.sh userscripts'
|
||||||
Volume ↑ ^ 1 ^ sxmo_vol.sh up
|
)
|
||||||
Volume ↓ ^ 1 ^ sxmo_vol.sh down
|
Scripts ^ 0 ^ sxmo_appmenu.sh scripts
|
||||||
Dialer ^ 0 ^ sxmo_modemcall.sh dial
|
Apps ^ 0 ^ sxmo_appmenu.sh applications
|
||||||
Texts ^ 0 ^ sxmo_modemtext.sh
|
Volume ↑ ^ 1 ^ sxmo_vol.sh up
|
||||||
Camera ^ 0 ^ sxmo_camera.sh
|
Volume ↓ ^ 1 ^ sxmo_vol.sh down
|
||||||
Wifi ^ 0 ^ st -e "nmtui"
|
Dialer ^ 0 ^ sxmo_modemcall.sh dial
|
||||||
Audio ^ 0 ^ sxmo_appmenu.sh audioout
|
Texts ^ 0 ^ sxmo_modemtext.sh
|
||||||
Config ^ 0 ^ sxmo_appmenu.sh config
|
Camera ^ 0 ^ sxmo_camera.sh
|
||||||
Logout ^ 0 ^ pkill -9 dwm
|
Wifi ^ 0 ^ st -e "nmtui"
|
||||||
|
Audio ^ 0 ^ sxmo_appmenu.sh audioout
|
||||||
|
Config ^ 0 ^ sxmo_appmenu.sh config
|
||||||
|
Logout ^ 0 ^ pkill -9 dwm
|
||||||
")" && WINNAME=Sys
|
")" && WINNAME=Sys
|
||||||
|
|
||||||
# Userscripts menu
|
# Userscripts menu
|
||||||
echo $WMCLASS | grep -i "userscripts" &&
|
echo $WMCLASS | grep -i "userscripts" && CHOICES="$(
|
||||||
CHOICES="$(ls -1 $XDG_CONFIG_HOME/sxmo/userscripts | sed 's/ /\\ /' |
|
ls -1 $XDG_CONFIG_HOME/sxmo/userscripts |
|
||||||
awk '{printf "%s\t^ 0 ^ sh $XDG_CONFIG_HOME/sxmo/userscripts/%s \n", $0, $0}')" &&
|
sed 's/ /\\ /' |
|
||||||
WINNAME=Userscripts && return
|
awk '{printf "%s\t^ 0 ^ sh $XDG_CONFIG_HOME/sxmo/userscripts/%s \n", $0, $0}'
|
||||||
|
)" && WINNAME=Userscripts && return
|
||||||
|
|
||||||
|
# Scripts menu
|
||||||
|
echo $WMCLASS | grep -i "scripts" && CHOICES="$(echo "
|
||||||
|
Web Search ^ 0 ^ sxmo_websearch.sh
|
||||||
|
Files ^ 0 ^ sxmo_files.sh
|
||||||
|
Timer ^ 0 ^ sxmo_timer.sh
|
||||||
|
Youtube ^ 0 ^ sxmo_youtube.sh video
|
||||||
|
Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio
|
||||||
|
Weather ^ 0 ^ sxmo_weather.sh
|
||||||
|
RSS ^ 0 ^ sxmo_rss.sh
|
||||||
|
")" && WINNAME=Scripts && return
|
||||||
|
|
||||||
# Apps menu
|
# Apps menu
|
||||||
echo $WMCLASS | grep -i "applications" && CHOICES="$(echo "
|
echo $WMCLASS | grep -i "applications" && CHOICES="$(echo "
|
||||||
|
@ -39,17 +54,6 @@ programchoicesinit() {
|
||||||
Foxtrotgps ^ 0 ^ foxtrotgps
|
Foxtrotgps ^ 0 ^ foxtrotgps
|
||||||
")" && WINNAME=Apps && return
|
")" && WINNAME=Apps && return
|
||||||
|
|
||||||
# Scripts menu
|
|
||||||
echo $WMCLASS | grep -i "scripts" && CHOICES="$(echo "
|
|
||||||
Web Search ^ 0 ^ sxmo_websearch.sh
|
|
||||||
Files ^ 0 ^ sxmo_files.sh
|
|
||||||
Timer ^ 0 ^ sxmo_timer.sh
|
|
||||||
Youtube ^ 0 ^ sxmo_youtube.sh video
|
|
||||||
Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio
|
|
||||||
Weather ^ 0 ^ sxmo_weather.sh
|
|
||||||
RSS ^ 0 ^ sxmo_rss.sh
|
|
||||||
")" && WINNAME=Scripts && return
|
|
||||||
|
|
||||||
# System Control menu
|
# System Control menu
|
||||||
echo $WMCLASS | grep -i "config" && CHOICES="$(echo "
|
echo $WMCLASS | grep -i "config" && CHOICES="$(echo "
|
||||||
Brightesss ↑ ^ 1 ^ sxmo_brightness.sh up
|
Brightesss ↑ ^ 1 ^ sxmo_brightness.sh up
|
||||||
|
@ -57,7 +61,12 @@ programchoicesinit() {
|
||||||
Modem Toggle ^ 1 ^ sxmo_modemmonitortoggle.sh
|
Modem Toggle ^ 1 ^ sxmo_modemmonitortoggle.sh
|
||||||
Modem Info ^ 0 ^ sxmo_modeminfo.sh
|
Modem Info ^ 0 ^ sxmo_modeminfo.sh
|
||||||
Modem Log ^ 0 ^ sxmo_modemlog.sh
|
Modem Log ^ 0 ^ sxmo_modemlog.sh
|
||||||
Flash $(cat /sys/class/leds/white:flash/brightness | grep -E '^0$' > /dev/null && echo -n "Off → On" || echo -n "On → Off") ^ 1 ^ sxmo_flashtoggle.sh
|
Flash $(
|
||||||
|
cat /sys/class/leds/white:flash/brightness |
|
||||||
|
grep -E '^0$' > /dev/null &&
|
||||||
|
echo -n "Off → On" || echo -n "On → Off";
|
||||||
|
echo -n "^ 1 ^ sxmo_flashtoggle.sh"
|
||||||
|
)
|
||||||
Bar Toggle ^ 1 ^ key Alt+b
|
Bar Toggle ^ 1 ^ key Alt+b
|
||||||
Change Timezone ^ 1 ^ sxmo_timezonechange.sh
|
Change Timezone ^ 1 ^ sxmo_timezonechange.sh
|
||||||
Rotate ^ 1 ^ sxmo_rotate.sh
|
Rotate ^ 1 ^ sxmo_rotate.sh
|
||||||
|
@ -67,9 +76,9 @@ programchoicesinit() {
|
||||||
# Audio Out menu
|
# Audio Out menu
|
||||||
echo $WMCLASS | grep -i "audioout" && CURRENTDEV="$(sxmo_audiocurrentdevice.sh)" && CHOICES="$(echo "
|
echo $WMCLASS | grep -i "audioout" && CURRENTDEV="$(sxmo_audiocurrentdevice.sh)" && CHOICES="$(echo "
|
||||||
Headphones $([[ "$CURRENTDEV" == "Headphone" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones
|
Headphones $([[ "$CURRENTDEV" == "Headphone" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones
|
||||||
Speaker $([[ "$CURRENTDEV" == "Line Out" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker
|
Speaker $([[ "$CURRENTDEV" == "Line Out" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker
|
||||||
Earpiece $([[ "$CURRENTDEV" == "Earpiece" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece
|
Earpiece $([[ "$CURRENTDEV" == "Earpiece" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece
|
||||||
None $([[ "$CURRENTDEV" == "None" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh None
|
None $([[ "$CURRENTDEV" == "None" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh None
|
||||||
")" && WINNAME="Audio" && return
|
")" && WINNAME="Audio" && return
|
||||||
|
|
||||||
# MPV
|
# MPV
|
||||||
|
@ -91,7 +100,10 @@ programchoicesinit() {
|
||||||
echo $WMCLASS | grep -i "st-256color" && STSELMODEON="$(echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' ')" && CHOICES="$(echo "
|
echo $WMCLASS | grep -i "st-256color" && STSELMODEON="$(echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' ')" && CHOICES="$(echo "
|
||||||
Type complete ^ 0 ^ key Ctrl+Shift+u
|
Type complete ^ 0 ^ key Ctrl+Shift+u
|
||||||
Copy complete ^ 0 ^ key Ctrl+Shift+i
|
Copy complete ^ 0 ^ key Ctrl+Shift+i
|
||||||
Selmode $([ $STSELMODEON == 1 ] && echo 'On → Off' || echo 'Off → On') ^ 0 ^ key Ctrl+Shift+s
|
Selmode $(
|
||||||
|
[ $STSELMODEON == 1 ] && printf %b 'On → Off' || printf %b 'Off → On';
|
||||||
|
printf %b '^ 0 ^ key Ctrl+Shift+s'
|
||||||
|
)
|
||||||
$([ $STSELMODEON == 1 ] && echo 'Copy selection ^ 0 ^ key Ctrl+Shift+c')
|
$([ $STSELMODEON == 1 ] && echo 'Copy selection ^ 0 ^ key Ctrl+Shift+c')
|
||||||
Paste ^ 0 ^ key Ctrl+Shift+v
|
Paste ^ 0 ^ key Ctrl+Shift+v
|
||||||
Zoom + ^ 1 ^ key Ctrl+Shift+Prior
|
Zoom + ^ 1 ^ key Ctrl+Shift+Prior
|
||||||
|
|
|
@ -1,28 +1,39 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
# Env vars
|
||||||
source /etc/profile
|
source /etc/profile
|
||||||
which $TERM || export TERM=st
|
which $TERM || export TERM=st
|
||||||
which $BROWSER || export BROWSER=surf
|
which $BROWSER || export BROWSER=surf
|
||||||
[ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1
|
[ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1
|
||||||
[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config
|
[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config
|
||||||
|
|
||||||
|
# Setup audio and a few sensible X defaults
|
||||||
|
alsactl --file /usr/share/sxmo/default_alsa_sound.conf restore
|
||||||
xmodmap /usr/share/sxmo/xmodmap_caps_esc
|
xmodmap /usr/share/sxmo/xmodmap_caps_esc
|
||||||
xsetroot -mod 3 2 -fg '#000000' -bg '#888888'
|
xsetroot -mod 3 2 -fg '#000000' -bg '#888888'
|
||||||
xset s off -dpms
|
xset s off -dpms
|
||||||
alsactl --file /usr/share/sxmo/default_alsa_sound.conf restore
|
|
||||||
#xset r off
|
|
||||||
|
|
||||||
# Xresources
|
|
||||||
xrdb /usr/share/sxmo/xresources_xcalc.xr
|
xrdb /usr/share/sxmo/xresources_xcalc.xr
|
||||||
|
|
||||||
# E.g. for PBP
|
|
||||||
synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25
|
synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25
|
||||||
keynav &
|
|
||||||
|
|
||||||
pkill lisgd
|
# Kill old hanging daemons
|
||||||
|
pkill lisgd && pkill conky
|
||||||
|
|
||||||
|
# Start daemons
|
||||||
conky -c /usr/share/sxmo/conky.conf -d
|
conky -c /usr/share/sxmo/conky.conf -d
|
||||||
autocutsel & autocutsel -selection PRIMARY &
|
keynav &
|
||||||
|
autocutsel &
|
||||||
|
autocutsel -selection PRIMARY &
|
||||||
sxmo_statusbar.sh &
|
sxmo_statusbar.sh &
|
||||||
exec dbus-run-session sh -c "dunst -conf /usr/share/sxmo/dunst.conf & lisgd &
|
|
||||||
[ -d "~/.sxmo" ] && notify-send -t 0 -u critical '~/.sxmo is deprecated. To preserve your modem logs, please move the contents of the ~/.sxmo folder into the $XDG_CONFIG_HOME/sxmo/modem/ folder' &
|
# Start dunst, lisgd (after dunst so it's in dbus path) and dwm
|
||||||
dwm 2> ~/.dwm.log"
|
LEGACYSXMOFOLDERWARNING="
|
||||||
|
Warning: ~/.sxmo is deprecated since sxmo-utils 1.1.5.
|
||||||
|
Modem call logs/texts location have moved.
|
||||||
|
Please move the contents of the ~/.sxmo/ folder to $XDG_CONFIG_HOME/sxmo/modem/
|
||||||
|
"
|
||||||
|
|
||||||
|
exec dbus-run-session sh -c "
|
||||||
|
dunst -conf /usr/share/sxmo/dunst.conf &
|
||||||
|
lisgd &
|
||||||
|
[ -d "/home/$USER/.sxmo" ] && notify-send -t 0 -u critical '$LEGACYSXMOFOLDERWARNING' &
|
||||||
|
dwm 2> ~/.dwm.log
|
||||||
|
"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue