mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-03-31 00:17:46 +02: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
|
for_window [instance="dropdown_*"] move position center
|
||||||
|
|
||||||
bar {
|
bar {
|
||||||
font pango:mono 13
|
font pango:mono 14
|
||||||
status_command i3blocks
|
status_command i3blocks
|
||||||
position top
|
position top
|
||||||
mode dock
|
mode dock
|
||||||
@ -49,6 +49,8 @@ bindsym $mod+Shift+b bar mode toggle
|
|||||||
|
|
||||||
#bindsym $mod+c taken by sxhkd
|
#bindsym $mod+c taken by sxhkd
|
||||||
|
|
||||||
|
bindsym $mod+Shift+d floating toggle
|
||||||
|
|
||||||
bindsym $mod+Shift+f fullscreen toggle
|
bindsym $mod+Shift+f fullscreen toggle
|
||||||
|
|
||||||
bindsym $mod+h focus left
|
bindsym $mod+h focus left
|
||||||
@ -67,8 +69,10 @@ bindsym $mod+l focus right
|
|||||||
bindsym $mod+Shift+l move right 30
|
bindsym $mod+Shift+l move right 30
|
||||||
|
|
||||||
#bindsym $mod+m taken by sxhkd
|
#bindsym $mod+m taken by sxhkd
|
||||||
|
bindsym $mod+Shift+m move scratchpad
|
||||||
|
|
||||||
#bindsym $mod+n taken by sxhkd
|
#bindsym $mod+n taken by sxhkd
|
||||||
|
#bindsym $mod+Shift+n taken by sxhkd
|
||||||
|
|
||||||
bindsym $mod+Shift+o exec --no-startup-id i3resize right
|
bindsym $mod+Shift+o exec --no-startup-id i3resize right
|
||||||
|
|
||||||
@ -113,9 +117,9 @@ set $ws4 "CHT"
|
|||||||
set $ws5 "DOC"
|
set $ws5 "DOC"
|
||||||
set $ws6 "WRK"
|
set $ws6 "WRK"
|
||||||
set $ws7 "EXT"
|
set $ws7 "EXT"
|
||||||
set $ws8 "ET1"
|
set $ws8 "GMG"
|
||||||
set $ws9 "ET2"
|
set $ws9 "ET1"
|
||||||
set $ws0 "ET3"
|
set $ws0 "ET2"
|
||||||
|
|
||||||
# switch to workspace
|
# switch to workspace
|
||||||
bindsym $mod+1 workspace $ws1
|
bindsym $mod+1 workspace $ws1
|
||||||
|
@ -6,6 +6,7 @@ super + b
|
|||||||
$BROWSER
|
$BROWSER
|
||||||
super + c
|
super + c
|
||||||
code
|
code
|
||||||
|
#super + shift + d taken by i3
|
||||||
super + f
|
super + f
|
||||||
$TERMINAL -e $FILE
|
$TERMINAL -e $FILE
|
||||||
#super + shift + f taken by i3
|
#super + shift + f taken by i3
|
||||||
@ -22,8 +23,11 @@ super + i
|
|||||||
#super + shift + l taken by i3
|
#super + shift + l taken by i3
|
||||||
super + m
|
super + m
|
||||||
thunderbird
|
thunderbird
|
||||||
|
#super + shift + m taken by i3
|
||||||
super + n
|
super + n
|
||||||
$TERMINAL -e newsboat
|
$TERMINAL -e newsboat
|
||||||
|
super + shift + n
|
||||||
|
i3-scratchpad-dmenu.py
|
||||||
#super + shift + o taken by i3
|
#super + shift + o taken by i3
|
||||||
#super + q taken by i3
|
#super + q taken by i3
|
||||||
#super + shift + 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