more screens for qtile

This commit is contained in:
Daniel Mevec 2022-07-05 08:20:08 +02:00
parent 34e2ffe43b
commit 564e5da7d8
3 changed files with 118 additions and 34 deletions

View file

@ -11,6 +11,8 @@ from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
from typing import List # noqa: F401from typing import List # noqa: F401
from qutils import get_num_screens
mod = "mod4" # Sets mod key to SUPER/WINDOWS
myTerm = "alacritty" # My terminal of choice
myBrowser = "qutebrowser" # My browser of choice
@ -33,8 +35,8 @@ class Colors:
keys = [
### The essentials
Key([mod], "Return", lazy.spawn(myTerm), desc='Launches My Terminal'),
# Key([mod, "shift"], "Return", lazy.spawn("dm-run"), desc='Run Launcher'),
Key([mod, "shift"], "Return", lazy.spawn("ulauncher"), desc='Run Launcher'),
Key([mod, "shift"], "Return", lazy.spawn("rofi -show run"), desc='Run Launcher'),
# Key([mod, "shift"], "Return", lazy.spawn("ulauncher"), desc='Run Launcher'),
# Key([mod, "shift"], "Return", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
Key([mod], "b", lazy.spawn(myBrowser),desc='Qutebrowser'),
# Key([mod], "/", lazy.spawn("dtos-help"), desc='DTOS Help'),
@ -235,16 +237,23 @@ def init_widgets_list():
background = Colors.bg,
foreground = Colors.yellow,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.TextBox(
text = u"\uf8c7",
foreground = Colors.bg,
widget.Battery(
battery = 0,
fmt = ' {}',
charge_char = u'\uf583',
discharge_char = u'\uf57d',
empty_char = u'\uf582',
full_char = u'\uf578',
unknown_char = u'\uf590',
format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
background = Colors.yellow,
fontsize = 14
foreground = Colors.bg,
),
# widget.Battery(
# battery = 0,
# battery = 1,
# fmt = ' {}',
# charge_char = u'\uf583',
# discharge_char = u'\uf57d',
@ -255,31 +264,20 @@ def init_widgets_list():
# background = Colors.yellow,
# foreground = Colors.bg,
# ),
# widget.Battery(
# battery = 0,
# fmt = ' {}',
# charge_char = u'\uf583',
# discharge_char = u'\uf57d',
# empty_char = u'\uf582',
# full_char = u'\uf578',
# unknown_char = u'\uf590',
# format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
# background = Colors.yellow,
# widget.Net(
# interface = "enp0s31f6",
# format = '{down} ↓↑ {up}',
# prefix='M',
# foreground = Colors.bg,
# background = Colors.yellow,
# ),
widget.Net(
interface = "enp0s31f6",
format = '{down} ↓↑ {up}',
prefix='M',
foreground = Colors.bg,
background = Colors.yellow,
),
widget.TextBox(
text = u'\ue0be',
background = Colors.yellow,
foreground = Colors.orange,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.TextBox(
text = u"\uf8c7",
@ -298,7 +296,8 @@ def init_widgets_list():
background = Colors.orange,
foreground = Colors.red,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.TextBox(
text = u"\uf546",
@ -321,7 +320,8 @@ def init_widgets_list():
background = Colors.red,
foreground = Colors.purple,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.TextBox(
text = u"\uf85a",
@ -341,7 +341,8 @@ def init_widgets_list():
background = Colors.purple,
foreground = Colors.blue,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.TextBox(
text = u"\ufb19",
@ -360,7 +361,8 @@ def init_widgets_list():
background = Colors.blue,
foreground = Colors.aqua,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.TextBox(
text = u"\uf026",
@ -378,7 +380,8 @@ def init_widgets_list():
background = Colors.aqua,
foreground = Colors.green,
padding = 0,
fontsize = 26
fontsize = 26,
width = 24
),
widget.Clock(
foreground = Colors.bg,
@ -400,10 +403,19 @@ def init_widgets_screen2():
return widgets_screen2 # Monitor 2 will display all widgets in widgets_list
def init_screens():
num_screens = get_num_screens()
if num_screens >= 1:
return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20))]
elif num_screens == 2:
return [
Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20)),
Screen(top=bar.Bar(widgets=init_widgets_screen2(), opacity=1.0, size=20)),
# Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20))
]
else:
return [
Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20)),
Screen(top=bar.Bar(widgets=init_widgets_screen2(), opacity=1.0, size=20)),
Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20)),
]
if __name__ in ["config", "__main__"]:

View file

@ -0,0 +1,41 @@
def get_num_screens():
from Xlib import display as xdisplay
num_monitors = 0
try:
display = xdisplay.Display()
screen = display.screen()
resources = screen.root.xrandr_get_screen_resources()
for output in resources.outputs:
monitor = display.xrandr_get_output_info(output, resources.config_timestamp)
preferred = False
if hasattr(monitor, "preferred"):
preferred = monitor.preferred
elif hasattr(monitor, "num_preferred"):
preferred = monitor.num_preferred
if preferred:
num_monitors += 1
except:
raise
return 1
else:
return num_monitors
class Colors:
bg = ["#282828", "#3c3836"] #background
fg = ["#ebdbb2", "#fbf1c7"] #foreground
red = ["#cc241d", "#fb4934"]
green = ["#98971a", "#b8bb26"]
yellow = ["#d79921", "#fabd2f"]
blue = ["#458588", "#83a598"]
purple = ["#b16286", "#d3869b"]
aqua = ["#689d6a", "#8ec07c"]
orange = ["#d65d0e", "#fe8019"]
gray = ["#928374", "#a89984"]
grey = gray
def _init_(self ):
pass
if __name__ == "__main__":
print("Number of Screens: {}".format(get_num_screens()))

31
dot_profile Normal file
View file

@ -0,0 +1,31 @@
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
. "$HOME/.cargo/env"
export EDITOR='hx'
export VISUAL='hx'