mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-03-27 21:47:46 +01:00
scratchpad shortcuts for i3
This commit is contained in:
parent
194f7f6241
commit
1b7789abef
@ -32,7 +32,7 @@ for_window [instance="dropdown_dropdowncalc"] border pixel 2
|
||||
for_window [instance="dropdown_*"] move position center
|
||||
|
||||
bar {
|
||||
font pango:mono 13
|
||||
font pango:mono 14
|
||||
status_command i3blocks
|
||||
position top
|
||||
mode dock
|
||||
@ -49,6 +49,8 @@ bindsym $mod+Shift+b bar mode toggle
|
||||
|
||||
#bindsym $mod+c taken by sxhkd
|
||||
|
||||
bindsym $mod+Shift+d floating toggle
|
||||
|
||||
bindsym $mod+Shift+f fullscreen toggle
|
||||
|
||||
bindsym $mod+h focus left
|
||||
@ -67,8 +69,10 @@ bindsym $mod+l focus right
|
||||
bindsym $mod+Shift+l move right 30
|
||||
|
||||
#bindsym $mod+m taken by sxhkd
|
||||
bindsym $mod+Shift+m move scratchpad
|
||||
|
||||
#bindsym $mod+n taken by sxhkd
|
||||
#bindsym $mod+Shift+n taken by sxhkd
|
||||
|
||||
bindsym $mod+Shift+o exec --no-startup-id i3resize right
|
||||
|
||||
@ -113,9 +117,9 @@ set $ws4 "CHT"
|
||||
set $ws5 "DOC"
|
||||
set $ws6 "WRK"
|
||||
set $ws7 "EXT"
|
||||
set $ws8 "ET1"
|
||||
set $ws9 "ET2"
|
||||
set $ws0 "ET3"
|
||||
set $ws8 "GMG"
|
||||
set $ws9 "ET1"
|
||||
set $ws0 "ET2"
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace $ws1
|
||||
|
@ -6,6 +6,7 @@ super + b
|
||||
$BROWSER
|
||||
super + c
|
||||
code
|
||||
#super + shift + d taken by i3
|
||||
super + f
|
||||
$TERMINAL -e $FILE
|
||||
#super + shift + f taken by i3
|
||||
@ -22,8 +23,11 @@ super + i
|
||||
#super + shift + l taken by i3
|
||||
super + m
|
||||
thunderbird
|
||||
#super + shift + m taken by i3
|
||||
super + n
|
||||
$TERMINAL -e newsboat
|
||||
super + shift + n
|
||||
i3-scratchpad-dmenu.py
|
||||
#super + shift + o taken by i3
|
||||
#super + q taken by i3
|
||||
#super + shift + q taken by i3
|
||||
|
27
.local/bin/i3cmds/i3-scratchpad-dmenu.py
Normal file
27
.local/bin/i3cmds/i3-scratchpad-dmenu.py
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import i3ipc
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
i3 = i3ipc.Connection()
|
||||
|
||||
def get_scratchpad_windows():
|
||||
scratchpad_containers = i3.get_tree().scratchpad().descendants()
|
||||
return filter(lambda c: c.type == 'con' and c.name, scratchpad_containers)
|
||||
|
||||
def dmenu_choose(options):
|
||||
""" Show a dmenu to choose a string item from a list of *options*. """
|
||||
dmenu_process = subprocess.Popen(["dmenu", "-l", "10"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
stdoutdata, _ = dmenu_process.communicate("\n".join(options).encode())
|
||||
return stdoutdata.decode('utf-8')
|
||||
|
||||
def main():
|
||||
scratchpad_windows = get_scratchpad_windows()
|
||||
window_titles = [w.name for w in scratchpad_windows]
|
||||
if window_titles:
|
||||
window_to_restore = re.escape(dmenu_choose(window_titles).strip())
|
||||
i3.command('[title="{}"] scratchpad show'.format(window_to_restore))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user