automated screen detection
This commit is contained in:
@@ -33,13 +33,18 @@ laptop_bar = bar.Bar([
|
|||||||
*end_widgets(blue_color,main_bar_height,main_bar_fontsize),
|
*end_widgets(blue_color,main_bar_height,main_bar_fontsize),
|
||||||
],main_bar_height)
|
],main_bar_height)
|
||||||
|
|
||||||
#left bar
|
|
||||||
left_bar = bar.Bar([
|
left_bar = bar.Bar([
|
||||||
*Left_widgets(secondary_bar_height,secondary_bar_fontsize),
|
*Left_widgets(secondary_bar_height,secondary_bar_fontsize),
|
||||||
*volume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
|
*volume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
|
||||||
*end_widgets(blue_color,secondary_bar_height,secondary_bar_fontsize)
|
*end_widgets(blue_color,secondary_bar_height,secondary_bar_fontsize)
|
||||||
],secondary_bar_height)
|
],secondary_bar_height)
|
||||||
|
|
||||||
|
secondary_bar = bar.Bar([
|
||||||
|
*Left_widgets(secondary_bar_height,secondary_bar_fontsize),
|
||||||
|
*volume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
|
||||||
|
*end_widgets(blue_color,secondary_bar_height,secondary_bar_fontsize)
|
||||||
|
],secondary_bar_height)
|
||||||
|
|
||||||
top_bar = bar.Bar([
|
top_bar = bar.Bar([
|
||||||
*Left_widgets(secondary_bar_height,secondary_bar_fontsize),
|
*Left_widgets(secondary_bar_height,secondary_bar_fontsize),
|
||||||
*volume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
|
*volume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
|
||||||
|
|||||||
@@ -1,10 +1,38 @@
|
|||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from libqtile.config import Screen
|
from libqtile.config import Screen
|
||||||
|
|
||||||
from Bars import top_bar, left_bar, main_bar,laptop_bar
|
from Bars import top_bar, left_bar, main_bar,laptop_bar, secondary_bar
|
||||||
|
from defines import main_screen_res, top_screen_res
|
||||||
|
|
||||||
screens = [
|
screens = [
|
||||||
# Screen(bottom=top_bar),
|
# Screen(bottom=top_bar),
|
||||||
# Screen(top=left_bar),
|
# Screen(top=left_bar),
|
||||||
# Screen(top=main_bar),
|
# Screen(top=main_bar),
|
||||||
Screen(top=laptop_bar)
|
# Screen(top=laptop_bar)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
cmd = ['xrandr']
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
|
resolution_string, junk = p.communicate()
|
||||||
|
p.stdout.close()
|
||||||
|
screen_resolutions = [np.array(screen_res.split('x')).astype(np.int) for screen_res in re.findall('[0-9]+x[0-9]+(?=[^\\\\n]*\*)',str(resolution_string))]
|
||||||
|
number_of_screens = len(screen_resolutions)
|
||||||
|
max_width = max(screen_resolutions, key=lambda res: res[0])[0]
|
||||||
|
defined_main_window = False
|
||||||
|
for width, height in screen_resolutions:
|
||||||
|
if width == main_screen_res[0] and height == main_screen_res[1]:
|
||||||
|
screens.append(Screen(top=main_bar))
|
||||||
|
defined_main_window = True
|
||||||
|
elif width == top_screen_res[0] and height == top_screen_res[1]:
|
||||||
|
screens.append(Screen(bottom=top_bar))
|
||||||
|
elif width < height:
|
||||||
|
screens.append(Screen(top=left_bar))
|
||||||
|
elif width == max_width and not defined_main_window:
|
||||||
|
screens.append(Screen(top=laptop_bar))
|
||||||
|
defined_main_window = True
|
||||||
|
else:
|
||||||
|
screens.append(Screen(top=secondary_bar))
|
||||||
@@ -3,6 +3,8 @@ focus_color = '#bd93f9'
|
|||||||
border_width = 2
|
border_width = 2
|
||||||
mod = 'mod4'
|
mod = 'mod4'
|
||||||
hotkey_file='/home/paul/Hotkeys'
|
hotkey_file='/home/paul/Hotkeys'
|
||||||
|
main_screen_res = [3840,1440]
|
||||||
|
top_screen_res = [1440,780]
|
||||||
|
|
||||||
#region colors
|
#region colors
|
||||||
light_foreground_color = ['#f8f8f2','#f8f8f2']
|
light_foreground_color = ['#f8f8f2','#f8f8f2']
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# This is a test file for anything.
|
||||||
|
screens = []
|
||||||
|
main_screen_res = [3840,1440]
|
||||||
|
top_screen_res = [1440,780]
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
cmd = ['xrandr']
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
|
resolution_string, junk = p.communicate()
|
||||||
|
p.stdout.close()
|
||||||
|
screen_resolutions = [np.array(screen_res.split('x')).astype(np.int) for screen_res in re.findall('[0-9]+x[0-9]+(?=[^\\\\n]*\*)',str(resolution_string))]
|
||||||
|
number_of_screens = len(screen_resolutions)
|
||||||
|
max_width = max(screen_resolutions, key=lambda res: res[0])[0]
|
||||||
|
defined_main_window = False
|
||||||
|
for width, height in screen_resolutions:
|
||||||
|
if width == main_screen_res[0] and height == main_screen_res[1]:
|
||||||
|
screens+=['main_screen']
|
||||||
|
defined_main_window = True
|
||||||
|
elif width == top_screen_res[0] and height == top_screen_res[1]:
|
||||||
|
screens+=['top_screen']
|
||||||
|
elif width == max_width and not defined_main_window:
|
||||||
|
screens+=['laptop_screen']
|
||||||
|
defined_main_window = True
|
||||||
|
else:
|
||||||
|
screens+=['peripheral_screen']
|
||||||
|
print(screens)
|
||||||
Reference in New Issue
Block a user