summaryrefslogtreecommitdiff
path: root/lc
blob: 8facc37014727617a3e5ab1f31e1f793d5824d54 (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
#!/bin/bash

Menu="Program Info System"
System="update poweroff syspend set-keyboard"
Info="battery"
Program="cups-website vim emacs htop"
All="$System $Info $Program"

handle_stuff() {

# Dmemu listing
	if [ "$1" = "--list" ]; then
		printf "Program\nInfo\nSystem"
	fi
	if [ "$1" = "--dmenu" ]; then
		./lc $(echo $Menu $All | tr " " "\n" | dmenu -i -p Launch)
	fi
	if [ "$1" = "System" ]; then
		./lc $(echo $System | tr " " "\n" | dmenu -i -p Launch)
	fi
	if [ "$1" = "Info" ]; then
		./lc $(echo $Info | tr " " "\n" | dmenu -i -p Launch)
	fi
	if [ "$1" = "Program" ]; then
		./lc $(echo $Program | tr " " "\n" | dmenu -i -p Launch)
	fi

# System info
	if [ "$1" = "-b" ] || [ "$1" = "battery" ]; then
		notify-send "Battery information" "$(acpi | grep 1:)"
	fi

# System maintenance
	if [ "$1" = "-u" ] || [ "$1" = "update" ]; then
		st -e sudo pacman -Syu
	fi
	if [ "$1" = "--xk" ] || [ "$1" = "set-keyboard" ]; then
		setxkbmap -layout us -variant altgr-intl
		xmodmap .Xmodmap
	fi

# POWER COMMANDS
	if [ "$1" = "-s" ] || [ "$1" = "suspend" ]; then
		systemctl suspend
	fi
	if [ "$1" = "-p" ] || [ "$1" = "poweroff" ]; then
		poweroff
	fi

# Launch
	if [ "$1" = "-v" ] || [ "$1" = "vim" ]; then
		st -e nvim
	fi
	if [ "$1" = "--emacs" ] || [ "$1" = "emacs" ]; then
		st -e emacs
	fi
	if [ "$1" = "--ht" ] || [ "$1" = "htop" ]; then
		st -e htop
	fi
	if [ "$1" = "--cups" ] || [ "$1" = "cups-website" ]; then
		firefox "http://localhost:631/"
	fi

# Calc
	if [ "$(echo $1 | head -c 1)" = "=" ]; then
		calc="$(echo $1 | cut -c 2-)"
		notify-send "Result" "$calc = $(echo $calc | bc)"
	fi
}


for var in "$@"
do
	handle_stuff "$var" &
done