Laptop config changes

This commit is contained in:
Kevin Alberts 2020-10-14 18:57:20 +02:00
parent 2e81ad001f
commit 705a2aaaa7
Signed by: Kurocon
GPG key ID: BCD496FEBA0C6BC1
6 changed files with 878 additions and 421 deletions

View file

@ -53,12 +53,12 @@ except ImportError as e:
try: try:
logger.error("Initializing theme...") logger.info("Initializing theme...")
# Initialize the Theme # Initialize the Theme
Theme.initialize() Theme.initialize()
logger.error("Initialize done") logger.info("Initialize done")
logger.error("Hooking theme into callbacks...") logger.info("Hooking theme into callbacks...")
# Hook theme into all hooks we know of # Hook theme into all hooks we know of
hook.subscribe.startup_once(Theme.callback_startup_once) hook.subscribe.startup_once(Theme.callback_startup_once)
hook.subscribe.startup(Theme.callback_startup) hook.subscribe.startup(Theme.callback_startup)
@ -73,8 +73,6 @@ try:
hook.subscribe.client_new(Theme.callback_client_new) hook.subscribe.client_new(Theme.callback_client_new)
hook.subscribe.client_managed(Theme.callback_client_managed) hook.subscribe.client_managed(Theme.callback_client_managed)
hook.subscribe.client_killed(Theme.callback_client_killed) hook.subscribe.client_killed(Theme.callback_client_killed)
hook.subscribe.client_state_changed(Theme.callback_client_state_changed)
hook.subscribe.client_type_changed(Theme.callback_client_type_changed)
hook.subscribe.client_focus(Theme.callback_client_focus) hook.subscribe.client_focus(Theme.callback_client_focus)
hook.subscribe.client_mouse_enter(Theme.callback_client_mouse_enter) hook.subscribe.client_mouse_enter(Theme.callback_client_mouse_enter)
hook.subscribe.client_name_updated(Theme.callback_client_name_updated) hook.subscribe.client_name_updated(Theme.callback_client_name_updated)
@ -85,9 +83,9 @@ try:
hook.subscribe.selection_change(Theme.callback_selection_change) hook.subscribe.selection_change(Theme.callback_selection_change)
hook.subscribe.screen_change(Theme.callback_screen_change) hook.subscribe.screen_change(Theme.callback_screen_change)
hook.subscribe.current_screen_change(Theme.callback_current_screen_change) hook.subscribe.current_screen_change(Theme.callback_current_screen_change)
logger.error("Hooking done") logger.info("Hooking done")
logger.error("Initializing theme variables") logger.info("Initializing theme variables")
# Initialize variables from theme # Initialize variables from theme
keys = Theme.keys keys = Theme.keys
mouse = Theme.mouse mouse = Theme.mouse
@ -104,8 +102,9 @@ try:
floating_layout = Theme.floating_layout floating_layout = Theme.floating_layout
auto_fullscreen = Theme.auto_fullscreen auto_fullscreen = Theme.auto_fullscreen
focus_on_window_activation = Theme.focus_on_window_activation focus_on_window_activation = Theme.focus_on_window_activation
extentions = Theme.extensions extensions = Theme.extensions
logger.error("Variable initialization done") wmname = Theme.wmname
logger.info("Variable initialization done")
except Exception as e: except Exception as e:
Theme = None Theme = None
Config = None Config = None

View file

@ -19,7 +19,7 @@ class Config(BaseConfig):
app_launcher = "/home/kevin/bin/dmenu_wal.sh" app_launcher = "/home/kevin/bin/dmenu_wal.sh"
web_browser = "firefox-developer-edition" web_browser = "firefox-developer-edition"
file_manager = "thunar" file_manager = "thunar"
app_chat = "franz" app_chat = "/home/kevin/bin/ramboxpro"
app_irc = "quasselclient" app_irc = "quasselclient"
app_mail = "thunderbird" app_mail = "thunderbird"
cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10" cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10"
@ -27,6 +27,7 @@ class Config(BaseConfig):
lock_command = "bash /home/kevin/bin/lock.sh" lock_command = "bash /home/kevin/bin/lock.sh"
visualizer_app = "glava" visualizer_app = "glava"
cmd_screenshot = "xfce4-screenshooter -r -c -d 1" cmd_screenshot = "xfce4-screenshooter -r -c -d 1"
cmd_alt_screenshot = "xfce4-screenshooter -w -c -d 0"
# Commands # Commands
wallpaper_config_command = "/home/kevin/bin/wal-nitrogen-noupdate" wallpaper_config_command = "/home/kevin/bin/wal-nitrogen-noupdate"
@ -71,7 +72,7 @@ class Config(BaseConfig):
bar_hover_opacity = 1 bar_hover_opacity = 1
# Groupbox variables # Groupbox variables
font_groupbox = "FontAwesome" font_groupbox = "Font Awesome 5 Pro"
fontsize_groupbox = 15 fontsize_groupbox = 15
width_groupbox_border = 1 width_groupbox_border = 1
height_groupbox = 24 height_groupbox = 24
@ -119,10 +120,8 @@ class Config(BaseConfig):
volume_font = "Noto Sans" volume_font = "Noto Sans"
volume_fontsize = 11 volume_fontsize = 11
volume_theme_path = "/home/kevin/.config/qtile/kuro/resources/volume" volume_theme_path = "/home/kevin/.config/qtile/kuro/resources/volume"
volume_get_command = "pamixer --get-volume".split() volume_pulse_sink = "alsa_output.pci-0000_00_1f.3.analog-stereo"
volume_mute_command = "pamixer -t".split()
volume_up_command = "pamixer -i 2".split()
volume_down_command = "pamixer -d 2".split()
volume_is_bluetooth_icon = False volume_is_bluetooth_icon = False
volume_update_interval = 0.2 volume_update_interval = 0.2
@ -143,8 +142,8 @@ class Config(BaseConfig):
updates_colour_available = '#f4d742' updates_colour_available = '#f4d742'
# Screen organization # Screen organization
laptop_screen_nvidia = "DP-2" laptop_screen_nvidia = "eDP-1-1"
laptop_screen_intel = "DP-2" laptop_screen_intel = "eDP1"
# Keyboard colors # Keyboard colors
do_keyboard_updates = False do_keyboard_updates = False
@ -155,3 +154,7 @@ class Config(BaseConfig):
# Show thermal widget # Show thermal widget
show_temperature = True show_temperature = True
# Audio control applications
# apps_audio = ["pavucontrol"]
apps_audio_afterstart = "/home/kevin/bin/start_jack_audio_chain.sh"

View file

@ -71,7 +71,7 @@ class Kuro(BaseTheme):
do_keyboard_updates = True do_keyboard_updates = True
# Window manager name # Window manager name
wmname = "QTile" wmname = "qtile"
# Floating layout override # Floating layout override
floating_layout = kuro_layouts.KuroFloating(float_rules=[ floating_layout = kuro_layouts.KuroFloating(float_rules=[
@ -180,6 +180,9 @@ class Kuro(BaseTheme):
# Screenshot key # Screenshot key
Key([], "Print", lazy.spawn(Config.get('cmd_screenshot', 'xfce4-screenshooter'))), Key([], "Print", lazy.spawn(Config.get('cmd_screenshot', 'xfce4-screenshooter'))),
# Alt Screenshot
Key([self.mod], "Print", lazy.spawn(Config.get('cmd_alt_screenshot', 'xfce4-screenshooter'))),
# Toggle between different layouts as defined below # Toggle between different layouts as defined below
Key([self.mod], "Tab", lazy.next_layout()), Key([self.mod], "Tab", lazy.next_layout()),
@ -239,6 +242,20 @@ class Kuro(BaseTheme):
groups.append(Group("")) groups.append(Group(""))
groups.append(Group("")) groups.append(Group(""))
groups.append(Group("")) groups.append(Group(""))
groups.append(Group("", spawn=Config.get('apps_audio', "true"), layout='verticaltile', layouts=[
layout.VerticalTile(
border_focus=Config.get('colour_border_focus', "#ffffff"),
border_normal=Config.get('colour_border_normal', "#777777"),
border_width=Config.get('width_border', "1"),
margin=Config.get('margin_layout', "0"),
)
]))
groups.append(Group("", layout='floating', layouts=[
layout.Floating(
border_focus="#990000",
border_normal="#440000"
)
]))
return groups return groups
@ -314,25 +331,15 @@ class Kuro(BaseTheme):
]) ])
if Config.get('show_audio_visualizer', False): if Config.get('show_audio_visualizer', False):
widgets.append(kuro.utils.widgets.AudioVisualizerWidget( widgets.append(kuro.utils.widgets.AudioVisualizerWidget(margin_x=0, margin_y=0))
graph_color=Config.get('visualizer_graph_color', "#ffffff"),
fill_color=Config.get('visualizer_fill_color', "#ffffff"),
border_color=Config.get('visualizer_border_color', "#000000"),
border_width=Config.get('visualizer_graph_width', 0),
line_width=Config.get('visualizer_line_width', 0),
margin_x=0,
margin_y=0,
frequency=1
))
widgets.extend([ widgets.extend([
kuro.utils.widgets.MediaWidget(), kuro.utils.widgets.MediaWidget(),
kuro.utils.widgets.TextSpacerWidget(fontsize=14),
kuro.utils.widgets.SeparatorWidget(),
]) ])
if Config.get('show_temperature', False): if Config.get('show_temperature', False):
widgets.append( widgets.extend([
kuro.utils.widgets.ThermalSensorWidget( kuro.utils.widgets.ThermalSensorWidget(
font=Config.get('font_topbar', 'Arial'), font=Config.get('font_topbar', 'Arial'),
fontsize=Config.get('fontsize_topbar', 16), fontsize=Config.get('fontsize_topbar', 16),
@ -342,99 +349,28 @@ class Kuro(BaseTheme):
chip=Config.get('thermal_chip', None), chip=Config.get('thermal_chip', None),
threshold=Config.get('thermal_threshold', 70), threshold=Config.get('thermal_threshold', 70),
update_interval=5, update_interval=5,
) fontsize_left=18, fontsize_right=11
) ),
])
widgets.extend([ widgets.extend([
widget.CPUGraph( kuro.utils.widgets.CPUInfoWidget(fontsize_left=16, fontsize_right=11),
width=Config.get('cpu_width', 25), kuro.utils.widgets.MemoryInfoWidget(fontsize_left=18, fontsize_right=11),
border_color=Config.get('cpu_border_colour', "#000000"), kuro.utils.widgets.DiskIOInfoWidget(fontsize_left=16, fontsize_right=11),
graph_color=Config.get('cpu_graph_colour', "#00ffff"), kuro.utils.widgets.BatteryInfoWidget(fontsize_left=16, fontsize_right=11),
border_width=Config.get('cpu_graph_width', 0), kuro.utils.widgets.VolumeInfoWidget(
line_width=Config.get('cpu_line_width', 1), pulse_sink=Config.get('volume_pulse_sink', None),
samples=Config.get('cpu_samples', 10), fontsize_left=18,
frequency=2, fontsize_right=11,
), ),
kuro.utils.widgets.TextSpacerWidget(fontsize=14),
widget.MemoryGraph( kuro.utils.widgets.NetworkInfoWidget(fontsize_left=16, fontsize_right=14),
width=Config.get('mem_width', 25), kuro.utils.widgets.GPUStatusWidget(
border_color=Config.get('mem_border_colour', "#000000"), theme_path=Config.get('gpu_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
graph_color=Config.get('mem_graph_colour', "#00ffff"), '/checkouts/latest/libqtile/resources/battery-icons'),
border_width=Config.get('mem_graph_width', 0), padding=0,
line_width=Config.get('mem_line_width', 1),
samples=Config.get('mem_samples', 10),
frequency=2,
), ),
kuro.utils.widgets.TextSpacerWidget(fontsize=14),
widget.HDDBusyGraph(
width=Config.get('hdd_width', 25),
border_color=Config.get('hdd_border_colour', "#000000"),
graph_color=Config.get('hdd_graph_colour', "#00ffff"),
border_width=Config.get('hdd_border_width', 0),
line_width=Config.get('hdd_line_width', 1),
samples=Config.get('hdd_samples', 10),
frequency=2,
),
widget.NetGraph(
width=Config.get('net_width', 25),
border_color=Config.get('net_border_colour', "#000000"),
graph_color=Config.get('net_graph_colour', "#00ffff"),
border_width=Config.get('net_border_width', 0),
line_width=Config.get('net_line_width', 1),
samples=Config.get('net_samples', 10),
frequency=2,
),
kuro.utils.widgets.KuroBatteryIcon(
battery_name=Config.get('battery_name', 'BAT0'),
energy_full_file=Config.get('battery_energy_full_file', 'charge_full'),
energy_now_file=Config.get('battery_energy_now_file', 'charge_now'),
theme_path=Config.get('battery_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
'/checkouts/latest/libqtile/resources/battery-icons'),
update_delay=Config.get('battery_update_delay', 30)
),
kuro.utils.widgets.WifiIconWidget(
interface=Config.get('wifi_interface', 'wlp4s0'),
theme_path=Config.get('wifi_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
'/checkouts/latest/libqtile/resources/battery-icons'),
update_interval=Config.get('wifi_update_interval', 30)
),
kuro.utils.widgets.PulseVolumeWidget(
cardid=Config.get('volume_cardid', None),
channel=Config.get('volume_channel', 'Master'),
device=Config.get('volume_device', None),
font=Config.get('volume_font', 'Arial'),
fontsize=Config.get('volume_fontsize', 15),
foreground=Config.get('volume_foreground', '#ffffff'),
get_volume_command=Config.get('volume_get_command', None),
mute_command=Config.get('volume_mute_command', None),
theme_path=Config.get('volume_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
'/checkouts/latest/libqtile/resources/volume-icons'),
volume_down_command=Config.get('volume_down_command', None),
volume_up_command=Config.get('volume_up_command', None),
is_bluetooth_icon=Config.get('volume_is_bluetooth_icon', False),
update_interval=Config.get('volume_update_interval', 0.2)
),
kuro.utils.widgets.PulseVolumeWidget(
cardid=Config.get('bluevol_cardid', None),
channel=Config.get('bluevol_channel', 'Master'),
device=Config.get('bluevol_device', None),
font=Config.get('bluevol_font', 'Arial'),
fontsize=Config.get('bluevol_fontsize', 15),
foreground=Config.get('bluevol_foreground', '#ffffff'),
get_volume_command=Config.get('bluevol_get_command', None),
mute_command=Config.get('bluevol_mute_command', None),
theme_path=Config.get('bluevol_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
'/checkouts/latest/libqtile/resources/volume-icons'),
volume_down_command=Config.get('bluevol_down_command', None),
volume_up_command=Config.get('bluevol_up_command', None),
is_bluetooth_icon=Config.get('bluevol_is_bluetooth_icon', False),
update_interval=Config.get('bluevol_update_interval', 0.2)
)
]) ])
# Systray can only be on one screen, so put it on the first # Systray can only be on one screen, so put it on the first
@ -505,6 +441,8 @@ class Kuro(BaseTheme):
for i, g in enumerate(self.groups): for i, g in enumerate(self.groups):
if i == 9: if i == 9:
i = -1 i = -1
elif i > 9:
continue
# mod1 + number = switch to group # mod1 + number = switch to group
self.keys.append( self.keys.append(
Key([self.mod], str(i + 1), lazy.group[g.name].toscreen()) Key([self.mod], str(i + 1), lazy.group[g.name].toscreen())
@ -604,11 +542,13 @@ class Kuro(BaseTheme):
utils.notify(title="Window properties {}".format(name), utils.notify(title="Window properties {}".format(name),
content="{}".format(pprint.pformat(vars(window)))) content="{}".format(pprint.pformat(vars(window))))
logger.warning("{}".format(pprint.pformat(vars(window))))
if info: if info:
info = pprint.pformat(info) info = pprint.pformat(info)
utils.notify(title="Window info of {}".format(name), utils.notify(title="Window info of {}".format(name),
content="{}".format(info)) content="{}".format(info))
logger.warning("{}".format(info))
# @staticmethod # @staticmethod
def toggle_window_static(self, qtile): def toggle_window_static(self, qtile):
@ -628,6 +568,10 @@ class Kuro(BaseTheme):
def callback_startup_once(self, *args, **kwargs): def callback_startup_once(self, *args, **kwargs):
self.update_wallpaper(self.qtile) self.update_wallpaper(self.qtile)
# Setup audio
# p = utils.execute_once(["qjackctl"])
# p.wait()
def callback_startup(self): def callback_startup(self):
if self.current_wallpaper: if self.current_wallpaper:
p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)]) p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)])
@ -692,10 +636,17 @@ class Kuro(BaseTheme):
self.callback_client_new() self.callback_client_new()
# After first startup is complete, start the audio apps that can only be started after boot is complete
if not self.qtile.no_spawn:
for app in Config.get("apps_audio_afterstart", []):
utils.execute_once(app)
# Update color scheme # Update color scheme
Kuro.update_colorscheme(self.qtile) Kuro.update_colorscheme(self.qtile)
def callback_client_new(self, *args, **kwargs): def callback_client_new(self, *args, **kwargs):
client = args[0] if len(args) > 0 else None
if len(self.initial_windows) > 0: if len(self.initial_windows) > 0:
init = self.initial_windows.copy() init = self.initial_windows.copy()
for pid, gname in init: for pid, gname in init:
@ -703,6 +654,8 @@ class Kuro(BaseTheme):
if len(group.windows) > 0: if len(group.windows) > 0:
for window in group.windows: for window in group.windows:
w_pid = window.window.get_net_wm_pid() w_pid = window.window.get_net_wm_pid()
self.log_info("Comparing pid {} with window PID {}, window {}".format(pid, w_pid,
window.name))
if pid == w_pid: if pid == w_pid:
c = self.qtile.dgroups.rules_map.copy() c = self.qtile.dgroups.rules_map.copy()
for rid, r in c.items(): for rid, r in c.items():
@ -711,11 +664,10 @@ class Kuro(BaseTheme):
self.initial_windows.remove((pid, gname)) self.initial_windows.remove((pid, gname))
self.log_info("Removed group rule for PID {}, window {}".format(pid, self.log_info("Removed group rule for PID {}, window {}".format(pid,
window.name)) window.name))
self.log_info(str(self.qtile.dgroups.rules_map)) self.log_info(str(self.qtile.dgroups.rules_map))
# Check if it is a visualizer # Check if it is a visualizer
if Config.get("show_audio_visualizer", False): if Config.get("show_audio_visualizer", False):
client = args[0] if len(args) > 0 else None
if client is not None and client.window.get_name() == "GLava": if client is not None and client.window.get_name() == "GLava":
placed = False placed = False
for screen in self.qtile.screens: for screen in self.qtile.screens:
@ -742,6 +694,14 @@ class Kuro(BaseTheme):
logger.warning("Not repositioning GLava {} because there is no widget where it can fit".format(client)) logger.warning("Not repositioning GLava {} because there is no widget where it can fit".format(client))
utils.notify("Glava", "Not repisitioning new GLava process because there is no screen without a visualizer") utils.notify("Glava", "Not repisitioning new GLava process because there is no screen without a visualizer")
# If this is Non-Mixer, move it to the audio group
logger.warning("Processing window {}".format(client))
if client is not None and client.window.get_wm_class() == ('Non-Mixer', 'Non-Mixer'):
logger.warning("Moving to correct group!")
client.window.togroup("")
def callback_client_killed(self, *args, **kwargs): def callback_client_killed(self, *args, **kwargs):
client = args[0] client = args[0]
logger.warning("Client {} Killed".format(client)) logger.warning("Client {} Killed".format(client))

View file

@ -1,19 +1,25 @@
import re import re
import subprocess import subprocess
import traceback
from time import sleep from time import sleep
import notify2 import notify2
import six import six
from dbus import DBusException
from libqtile import widget from libqtile import widget
from libqtile.window import Internal from libqtile.window import Internal
from libqtile.bar import Bar from libqtile.bar import Bar
from notify2 import Notification, URGENCY_NORMAL from notify2 import Notification, URGENCY_NORMAL
from libqtile.log_utils import logger
notify2.init("QTileWM") notify2.init("QTileWM")
BUTTON_LEFT = 1 BUTTON_LEFT = 1
BUTTON_MIDDLE = 2 BUTTON_MIDDLE = 2
BUTTON_RIGHT = 3 BUTTON_RIGHT = 3
BUTTON_UP = 4
BUTTON_DOWN = 5
BUTTON_MUTE = 1
BUTTON_SCROLL_UP = 4 BUTTON_SCROLL_UP = 4
BUTTON_SCROLL_DOWN = 5 BUTTON_SCROLL_DOWN = 5
@ -92,7 +98,11 @@ def notify(title, content, urgency=URGENCY_NORMAL, timeout=5000, image=None):
notification.set_timeout(timeout) notification.set_timeout(timeout)
notification.set_urgency(urgency) notification.set_urgency(urgency)
return notification.show() try:
return notification.show()
except DBusException as e:
logger.warning("Showing notification failed: {}".format(e))
logger.warning(traceback.format_exc())
def spawn_popup(qtile, x, y, text): def spawn_popup(qtile, x, y, text):

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@ pamixer
nitrogen nitrogen
notification-daemon notification-daemon
otf-font-awesome otf-font-awesome
python-osc
# /optional/ # /optional/
playerctl playerctl