Fix GPDP2 i3 config
Setup.sh options doni't work in directories.
This commit is contained in:
parent
4e71ba0259
commit
092d6884d0
4 changed files with 154 additions and 0 deletions
106
simpleDots/i3+gpdp2/alternating_layouts.py
Executable file
106
simpleDots/i3+gpdp2/alternating_layouts.py
Executable file
|
@ -0,0 +1,106 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import i3
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import getopt
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def find_parent(window_id):
|
||||||
|
"""
|
||||||
|
Find the parent of a given window id
|
||||||
|
"""
|
||||||
|
root_window = i3.get_tree()
|
||||||
|
result = [None]
|
||||||
|
|
||||||
|
def finder(n, p=None):
|
||||||
|
if result[0] is not None:
|
||||||
|
return
|
||||||
|
for node in n:
|
||||||
|
if node['id'] == window_id:
|
||||||
|
result[0] = p
|
||||||
|
return
|
||||||
|
if len(node['nodes']):
|
||||||
|
finder(node['nodes'], node)
|
||||||
|
|
||||||
|
finder(root_window['nodes'])
|
||||||
|
return result[0]
|
||||||
|
|
||||||
|
|
||||||
|
def set_layout():
|
||||||
|
"""
|
||||||
|
Set the layout/split for the currently
|
||||||
|
focused window to either vertical or
|
||||||
|
horizontal, depending on its width/height
|
||||||
|
"""
|
||||||
|
current_win = i3.filter(nodes=[], focused=True)
|
||||||
|
for win in current_win:
|
||||||
|
parent = find_parent(win['id'])
|
||||||
|
|
||||||
|
if (parent and "rect" in parent
|
||||||
|
and parent['layout'] != 'tabbed'
|
||||||
|
and parent['layout'] != 'stacked'):
|
||||||
|
height = parent['rect']['height']
|
||||||
|
width = parent['rect']['width']
|
||||||
|
|
||||||
|
if height > width:
|
||||||
|
new_layout = 'vertical'
|
||||||
|
else:
|
||||||
|
new_layout = 'horizontal'
|
||||||
|
|
||||||
|
i3.split(new_layout)
|
||||||
|
|
||||||
|
|
||||||
|
def print_help():
|
||||||
|
print("Usage: " + sys.argv[0] + " [-p path/to/pid.file]")
|
||||||
|
print("")
|
||||||
|
print("Options:")
|
||||||
|
print(" -p path/to/pid.file Saves the PID for this program in the filename specified")
|
||||||
|
print("")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
Main function - listen for window focus
|
||||||
|
changes and call set_layout when focus
|
||||||
|
changes
|
||||||
|
"""
|
||||||
|
opt_list, args = getopt.getopt(sys.argv[1:], 'hp:')
|
||||||
|
pid_file = None
|
||||||
|
for opt in opt_list:
|
||||||
|
if opt[0] == "-h":
|
||||||
|
print_help()
|
||||||
|
sys.exit()
|
||||||
|
if opt[0] == "-p":
|
||||||
|
pid_file = opt[1]
|
||||||
|
|
||||||
|
if pid_file:
|
||||||
|
with open(pid_file, 'w') as f:
|
||||||
|
f.write(str(os.getpid()))
|
||||||
|
|
||||||
|
|
||||||
|
process = subprocess.Popen(
|
||||||
|
['xprop', '-root', '-spy'],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE
|
||||||
|
)
|
||||||
|
regex = re.compile(b'^_NET_CLIENT_LIST_STACKING|^_NET_ACTIVE_WINDOW')
|
||||||
|
|
||||||
|
last_line = ""
|
||||||
|
while True:
|
||||||
|
line = process.stdout.readline()
|
||||||
|
if line == b'': #X is dead
|
||||||
|
break
|
||||||
|
if line == last_line:
|
||||||
|
continue
|
||||||
|
if regex.match(line):
|
||||||
|
set_layout()
|
||||||
|
last_line = line
|
||||||
|
|
||||||
|
process.kill()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
48
simpleDots/i3+gpdp2/dunstrc
Normal file
48
simpleDots/i3+gpdp2/dunstrc
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
[global]
|
||||||
|
font = Inconsolata 10
|
||||||
|
allow_markup = yes
|
||||||
|
format = "<b>%s</b>\n%b"
|
||||||
|
sort = yes
|
||||||
|
indicate_hidden = yes
|
||||||
|
alignment = right
|
||||||
|
bounce_freq = 0
|
||||||
|
show_age_threshold = 60
|
||||||
|
word_wrap = yes
|
||||||
|
ignore_newline = no
|
||||||
|
geometry = "200x5-6+30"
|
||||||
|
transparency = 0
|
||||||
|
idle_threshold = 120
|
||||||
|
monitor = 0
|
||||||
|
follow = mouse
|
||||||
|
sticky_history = yes
|
||||||
|
line_height = 0
|
||||||
|
separator_height = 2
|
||||||
|
padding = 8
|
||||||
|
horizontal_padding = 8
|
||||||
|
separator_color = "#585858"
|
||||||
|
startup_notification = false
|
||||||
|
|
||||||
|
[frame]
|
||||||
|
width = 1
|
||||||
|
color = "#383838"
|
||||||
|
|
||||||
|
[shortcuts]
|
||||||
|
close = ctrl+space
|
||||||
|
close_all = ctrl+shift+space
|
||||||
|
# history = ctrl+h
|
||||||
|
context = ctrl+shift+period
|
||||||
|
|
||||||
|
[urgency_low]
|
||||||
|
background = "#181818"
|
||||||
|
foreground = "#E3C7AF"
|
||||||
|
timeout = 5
|
||||||
|
|
||||||
|
[urgency_normal]
|
||||||
|
background = "#181818"
|
||||||
|
foreground = "#E3C7AF"
|
||||||
|
timeout = 20
|
||||||
|
|
||||||
|
[urgency_critical]
|
||||||
|
background = "#181818"
|
||||||
|
foreground = "#FF2121"
|
||||||
|
timeout = 0
|
Reference in a new issue