blob: e84d856774866f78ffc8a0fa8a1af70c8ba674a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/usr/bin/env bash
LOGFILE=.lc.log
DMENU="rofi -dmenu"
Commands="s suspend screen goto common bwpass remember forever set-keyboard sa-keyboard rotate poweroff lock scrot region overleaf-render caps-lock win wall cups pass sync random"
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
if [ "$1" = "sa" ] || [ "$1" = "sa-keyboard" ]; then
setxkbmap -layout us -variant colemak_dh_iso
#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" = "overleaf-render" ]; then
st sh ~/Documents/overleafRenderer/compile.sh
fi
if [ "$1" = "caps-lock" ]; then
xdotool key Caps_Lock
fi
if [ "$1" = "win" ]; then
vboxmanage startvm "Windows xp"
fi
if [ "$1" = "wall" ]; then
$HOME/Scripts/setwall -A
fi
if [ "$1" = "random" ]; then
stuff=$(python -c "print('\n'.join((str(i) for i in $(rofi -dmenu))))")
echo $stuff | tr " " "\n" | rofi -dmenu
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" = "s" ]; then
$HOME/Scripts/guiworkspace.sh
fi
if [ "$1" = "cups" ] || [ "$1" = "cups-website" ]; then
firefox "http://localhost:631/"
fi
if [ "$1" = "pass" ]; then
bash $HOME/Scripts/passmenu --type
fi
if [ "$1" = "bwpass" ]; then
bash $HOME/Scripts/bwmenu --type
fi
if [ "$1" = "common" ]; then
python3 Scripts/commondocs.py ~/commondocs.json $(python3 Scripts/commondocs.py ~/commondocs.json | $DMENU)
fi
if [ "$1" = "sync" ]; then
./Scripts/sync.sh
dunstify "Sync complete" "Sync completed at $(date)"
fi
if [ "$1" = "goto" ]; then
caja $(./Scripts/goto -d $(cat .bookmarks | awk -F ' ' '{print $1}' | $DMENU))
fi
if [ "$1" = "screen" ]; then
~/Scripts/screentool
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
|