#!/usr/bin/env bash LOGFILE=.lc.log DMENU="rofi -dmenu" Commands="s docpdf suspend screen common remember forever set-keyboard rotate poweroff lock scrot region caps-lock wall pass" handle_stuff() { if [ "$1" = "--dmenu" ]; then $0 $(echo $Commands | tr " " "\n" | $DMENU -i -p "lc") fi # System maintenance if [ "$1" = "sk" ] || [ "$1" = "set-keyboard" ]; then setxkbmap -layout us -variant altgr-intl #xcape -e "Control_R=Escape" # xmodmap .Xmodmap fi # POWER COMMANDS if [ "$1" = "suspend" ]; then systemctl suspend fi if [ "$1" = "poweroff" ]; then poweroff fi if [ "$1" = "lock" ]; then $HOME/Scripts/lock.sh fi # Mics imagename=$HOME/Screenshots/$(date -Iseconds)-screenshot.png if [ "$1" = "scrot" ]; then scrot $imagename fi if [ "$1" = "region" ]; then import $imagename xclip -selection clipboard -t image/png -i $imagename fi if [ "$1" = "caps-lock" ]; then xdotool key Caps_Lock fi if [ "$1" = "wall" ]; then setwall --config $WALLCONFIG fi if [ "$1" = "remember" ]; then import $imagename feh $imagename fi if [ "$1" = "forever" ]; then import $imagename feh $imagename echo "feh ${imagename} &" >> ~/remember_forever.sh fi if [ "$1" = "rotate" ]; then dir=$(echo -e "left\nright\ninvert\nnormal" | $DMENU -i -p "orientation") $HOME/Scripts/xrotate $dir fi # Launch if [ "$1" = "pass" ]; then bash $HOME/Scripts/passmenu --type fi if [ "$1" = "common" ]; then python3 Scripts/commondocs.py ~/commondocs.json $(python3 Scripts/commondocs.py ~/commondocs.json | $DMENU) fi if [ "$1" = "screen" ]; then ~/Scripts/screentool fi if [ "$!" = "docpdf" ]; then find ~/Documents -iname "*.pdf" -type f | fzf | xargs zathura fi # Calc if [ "$(echo $1 | head -c 1)" = "=" ]; then calc="$(echo $1 | cut -c 2-)" notify-send "Result" "$calc = $(echo $calc | bc)" fi } handle_stuff $* 2>&1 | tee -a $LOGFILE