-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand_palette.py
122 lines (117 loc) · 2.81 KB
/
command_palette.py
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
import os
import pydymenu
# from https://pythonawesome.com/pydymenu-pythonic-wrapper-for-fzf-and-rofi/
commands = [
{
'name': "Launch xkill to kill windows",
'command': "xkill"
},
{
'name': "Type random string",
'command': "~/dots/scripts/type_random_str.sh"
},
{
'name': "Type current datetime",
'command': "~/dots/scripts/type_datetime.sh"
},
{
'name': "Sandbox 1",
'command': "~/dots/scripts/sandbox1.sh"
},
{
'name': "Capture focused workspace (no bar)",
'command': "~/dots/scripts/capture_focused_workspace.sh"
},
{
'name': "Capture focused container",
'command': "~/dots/scripts/capture_focused_container.sh"
},
{
'name': "Launch spectrum analyser",
'command': "~/dots/scripts/spectrum_analyser.sh"
},
{
'name': "Screen setup",
'command': "~/dots/scripts/screen_setup_prompt.py"
},
{
'name': "Switch to HDMI1",
'command': "~/dots/scripts/i3_migrate_output.py HDMI1"
},
{
'name': "Switch to eDP1",
'command': "~/dots/scripts/i3_migrate_output.py eDP1"
},
{
'name': "Pick color as HEX (Mod+P)",
'command': "~/dots/scripts/pick_color.py"
},
{
'name': "Pick color as RGB",
'command': "~/dots/scripts/pick_color.py rgb"
},
{
'name': "Pick color as RGBA",
'command': "~/dots/scripts/pick_color.py rgba"
},
{
'name': "Refresh xrandr",
'command': "xrandr --auto"
},
{
'name': "Switch audio device (Mod+F12)",
'command': "node ~/dots/audio/switch_device.js"
},
{
'name': "Send test notif",
'command': "notify-send 'this is a test notif'"
},
{
'name': "Refresh wallpapers",
'command': "~/dots/scripts/refresh_wallpapers.sh"
},
{
'name': "Emoji picker (Mod+Alt+;)",
'command': "~/dots/scripts/emoji_picker.sh"
},
{
'name': "Unicode char picker (Mod+Alt+')",
'command': "~/dots/charpicker/global.py"
},
{
'name': "Send current date to clipboard",
'command': "~/dots/scripts/date_to_clipboard.sh"
},
{
'name': "Send current datetime to clipboard",
'command': "~/dots/scripts/datetime_to_clipboard.sh"
},
{
'name': "Send random string to clipboard",
'command': "~/dots/scripts/random_str_to_clipboard.sh"
},
{
'name': "Send fake lorem ipsum string to clipboard",
'command': "~/dots/scripts/lorem_to_clipboard.sh"
},
{
'name': "Open clipboard history (Mod+o)",
'command': "~/dots/scripts/clipboard_history.sh"
},
{
'name': "Remap keyboard",
'command': "~/dots/scripts/remap.sh"
}
]
selected = pydymenu.rofi(
list(map(lambda c: c['name'], commands)),
prompt="Pick a command"
)
if len(selected) == 0:
exit()
res = list(filter(lambda cmd: cmd['name'] == selected[0], commands))
if len(res) == 0:
print('invalid selection')
exit()
cmd = res[0]
os.system(cmd['command'])