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:
logger.error("Initializing theme...")
logger.info("Initializing theme...")
# Initialize the Theme
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.subscribe.startup_once(Theme.callback_startup_once)
hook.subscribe.startup(Theme.callback_startup)
@ -73,8 +73,6 @@ try:
hook.subscribe.client_new(Theme.callback_client_new)
hook.subscribe.client_managed(Theme.callback_client_managed)
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_mouse_enter(Theme.callback_client_mouse_enter)
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.screen_change(Theme.callback_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
keys = Theme.keys
mouse = Theme.mouse
@ -104,8 +102,9 @@ try:
floating_layout = Theme.floating_layout
auto_fullscreen = Theme.auto_fullscreen
focus_on_window_activation = Theme.focus_on_window_activation
extentions = Theme.extensions
logger.error("Variable initialization done")
extensions = Theme.extensions
wmname = Theme.wmname
logger.info("Variable initialization done")
except Exception as e:
Theme = None
Config = None

View file

@ -19,7 +19,7 @@ class Config(BaseConfig):
app_launcher = "/home/kevin/bin/dmenu_wal.sh"
web_browser = "firefox-developer-edition"
file_manager = "thunar"
app_chat = "franz"
app_chat = "/home/kevin/bin/ramboxpro"
app_irc = "quasselclient"
app_mail = "thunderbird"
cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10"
@ -27,6 +27,7 @@ class Config(BaseConfig):
lock_command = "bash /home/kevin/bin/lock.sh"
visualizer_app = "glava"
cmd_screenshot = "xfce4-screenshooter -r -c -d 1"
cmd_alt_screenshot = "xfce4-screenshooter -w -c -d 0"
# Commands
wallpaper_config_command = "/home/kevin/bin/wal-nitrogen-noupdate"
@ -71,7 +72,7 @@ class Config(BaseConfig):
bar_hover_opacity = 1
# Groupbox variables
font_groupbox = "FontAwesome"
font_groupbox = "Font Awesome 5 Pro"
fontsize_groupbox = 15
width_groupbox_border = 1
height_groupbox = 24
@ -119,10 +120,8 @@ class Config(BaseConfig):
volume_font = "Noto Sans"
volume_fontsize = 11
volume_theme_path = "/home/kevin/.config/qtile/kuro/resources/volume"
volume_get_command = "pamixer --get-volume".split()
volume_mute_command = "pamixer -t".split()
volume_up_command = "pamixer -i 2".split()
volume_down_command = "pamixer -d 2".split()
volume_pulse_sink = "alsa_output.pci-0000_00_1f.3.analog-stereo"
volume_is_bluetooth_icon = False
volume_update_interval = 0.2
@ -143,8 +142,8 @@ class Config(BaseConfig):
updates_colour_available = '#f4d742'
# Screen organization
laptop_screen_nvidia = "DP-2"
laptop_screen_intel = "DP-2"
laptop_screen_nvidia = "eDP-1-1"
laptop_screen_intel = "eDP1"
# Keyboard colors
do_keyboard_updates = False
@ -155,3 +154,7 @@ class Config(BaseConfig):
# Show thermal widget
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
# Window manager name
wmname = "QTile"
wmname = "qtile"
# Floating layout override
floating_layout = kuro_layouts.KuroFloating(float_rules=[
@ -180,6 +180,9 @@ class Kuro(BaseTheme):
# Screenshot key
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
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("", 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
@ -314,25 +331,15 @@ class Kuro(BaseTheme):
])
if Config.get('show_audio_visualizer', False):
widgets.append(kuro.utils.widgets.AudioVisualizerWidget(
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.append(kuro.utils.widgets.AudioVisualizerWidget(margin_x=0, margin_y=0))
widgets.extend([
kuro.utils.widgets.MediaWidget(),
kuro.utils.widgets.SeparatorWidget(),
kuro.utils.widgets.TextSpacerWidget(fontsize=14),
])
if Config.get('show_temperature', False):
widgets.append(
widgets.extend([
kuro.utils.widgets.ThermalSensorWidget(
font=Config.get('font_topbar', 'Arial'),
fontsize=Config.get('fontsize_topbar', 16),
@ -342,99 +349,28 @@ class Kuro(BaseTheme):
chip=Config.get('thermal_chip', None),
threshold=Config.get('thermal_threshold', 70),
update_interval=5,
)
)
fontsize_left=18, fontsize_right=11
),
])
widgets.extend([
widget.CPUGraph(
width=Config.get('cpu_width', 25),
border_color=Config.get('cpu_border_colour', "#000000"),
graph_color=Config.get('cpu_graph_colour', "#00ffff"),
border_width=Config.get('cpu_graph_width', 0),
line_width=Config.get('cpu_line_width', 1),
samples=Config.get('cpu_samples', 10),
frequency=2,
kuro.utils.widgets.CPUInfoWidget(fontsize_left=16, fontsize_right=11),
kuro.utils.widgets.MemoryInfoWidget(fontsize_left=18, fontsize_right=11),
kuro.utils.widgets.DiskIOInfoWidget(fontsize_left=16, fontsize_right=11),
kuro.utils.widgets.BatteryInfoWidget(fontsize_left=16, fontsize_right=11),
kuro.utils.widgets.VolumeInfoWidget(
pulse_sink=Config.get('volume_pulse_sink', None),
fontsize_left=18,
fontsize_right=11,
),
widget.MemoryGraph(
width=Config.get('mem_width', 25),
border_color=Config.get('mem_border_colour', "#000000"),
graph_color=Config.get('mem_graph_colour', "#00ffff"),
border_width=Config.get('mem_graph_width', 0),
line_width=Config.get('mem_line_width', 1),
samples=Config.get('mem_samples', 10),
frequency=2,
kuro.utils.widgets.TextSpacerWidget(fontsize=14),
kuro.utils.widgets.NetworkInfoWidget(fontsize_left=16, fontsize_right=14),
kuro.utils.widgets.GPUStatusWidget(
theme_path=Config.get('gpu_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
'/checkouts/latest/libqtile/resources/battery-icons'),
padding=0,
),
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)
)
kuro.utils.widgets.TextSpacerWidget(fontsize=14),
])
# 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):
if i == 9:
i = -1
elif i > 9:
continue
# mod1 + number = switch to group
self.keys.append(
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),
content="{}".format(pprint.pformat(vars(window))))
logger.warning("{}".format(pprint.pformat(vars(window))))
if info:
info = pprint.pformat(info)
utils.notify(title="Window info of {}".format(name),
content="{}".format(info))
logger.warning("{}".format(info))
# @staticmethod
def toggle_window_static(self, qtile):
@ -628,6 +568,10 @@ class Kuro(BaseTheme):
def callback_startup_once(self, *args, **kwargs):
self.update_wallpaper(self.qtile)
# Setup audio
# p = utils.execute_once(["qjackctl"])
# p.wait()
def callback_startup(self):
if 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()
# 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
Kuro.update_colorscheme(self.qtile)
def callback_client_new(self, *args, **kwargs):
client = args[0] if len(args) > 0 else None
if len(self.initial_windows) > 0:
init = self.initial_windows.copy()
for pid, gname in init:
@ -703,6 +654,8 @@ class Kuro(BaseTheme):
if len(group.windows) > 0:
for window in group.windows:
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:
c = self.qtile.dgroups.rules_map.copy()
for rid, r in c.items():
@ -711,11 +664,10 @@ class Kuro(BaseTheme):
self.initial_windows.remove((pid, gname))
self.log_info("Removed group rule for PID {}, window {}".format(pid,
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
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":
placed = False
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))
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):
client = args[0]
logger.warning("Client {} Killed".format(client))

View file

@ -1,19 +1,25 @@
import re
import subprocess
import traceback
from time import sleep
import notify2
import six
from dbus import DBusException
from libqtile import widget
from libqtile.window import Internal
from libqtile.bar import Bar
from notify2 import Notification, URGENCY_NORMAL
from libqtile.log_utils import logger
notify2.init("QTileWM")
BUTTON_LEFT = 1
BUTTON_MIDDLE = 2
BUTTON_RIGHT = 3
BUTTON_UP = 4
BUTTON_DOWN = 5
BUTTON_MUTE = 1
BUTTON_SCROLL_UP = 4
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_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):

File diff suppressed because it is too large Load diff

View file

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