Update configuration for new laptop, Fixes for new qtile internal api, PrintScreen button function, Compositor and Clipboard manager, Fix mouse actions

This commit is contained in:
Kevin Alberts 2019-08-20 22:33:07 +02:00
parent baece2297f
commit 95d2c26854
Signed by: Kurocon
GPG key ID: BCD496FEBA0C6BC1
10 changed files with 68 additions and 48 deletions

View file

@ -90,6 +90,7 @@ try:
logger.error("Initializing theme variables")
# Initialize variables from theme
keys = Theme.keys
mouse = Theme.mouse
groups = Theme.groups
layouts = Theme.layouts
widget_defaults = Theme.widget_defaults

View file

@ -67,6 +67,7 @@ class BaseTheme:
self.groups = self.init_groups()
self.layouts = self.init_layouts()
self.screens = self.init_screens()
self.mouse = self.init_mouse()
def init_keys(self):
return [

View file

@ -16,8 +16,7 @@ class Config(BaseConfig):
# Default Applications
app_terminal = "terminator"
app_launcher = "dmenu_run -i -p '»' -nb '" + background + "' -fn 'Noto Sans-11' -nf '" + inactive_light + \
"' -sb '" + highlight + "' -sf '" + foreground + "'"
app_launcher = "/home/kevin/bin/dmenu_wal.sh"
web_browser = "firefox-developer-edition"
file_manager = "thunar"
app_chat = "franz"
@ -25,8 +24,12 @@ class Config(BaseConfig):
app_mail = "thunderbird"
cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10"
cmd_brightness_down = "sudo /usr/bin/xbacklight -dec 10"
lock_command = "/home/kevin/bin/lock.sh"
lock_command = "bash /home/kevin/bin/lock.sh"
visualizer_app = "glava"
cmd_screenshot = "xfce4-screenshooter -r -c -d 1"
# Commands
wallpaper_config_command = "/home/kevin/bin/wal-nitrogen-noupdate"
# Images
desktop_bg = "/home/kevin/Pictures/wallpapers/desktop.png"
@ -104,7 +107,7 @@ class Config(BaseConfig):
battery_update_delay = 5
# Wifi variables
wifi_interface = "wlp4s0"
wifi_interface = "wifi0"
wifi_theme_path = "/home/kevin/.config/qtile/kuro/resources/wifi"
wifi_update_interval = 5
@ -115,10 +118,10 @@ class Config(BaseConfig):
volume_font = "Noto Sans"
volume_fontsize = 11
volume_theme_path = "/home/kevin/.config/qtile/kuro/resources/volume"
volume_get_command = "pamixer --sink 2 --get-volume".split()
volume_mute_command = "pamixer --sink 2 -t".split()
volume_up_command = "pamixer --sink 2 -i 2".split()
volume_down_command = "pamixer --sink 2 -d 2".split()
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_is_bluetooth_icon = False
volume_update_interval = 0.2
@ -139,8 +142,8 @@ class Config(BaseConfig):
updates_colour_available = '#f4d742'
# Screen organization
laptop_screen_nvidia = "eDP-1-1"
laptop_screen_intel = "eDP1"
laptop_screen_nvidia = "DP-2"
laptop_screen_intel = "DP-2"
# Keyboard colors
do_keyboard_updates = False
@ -149,3 +152,5 @@ class Config(BaseConfig):
show_audio_visualizer = True
kill_unnecessary_glava_processes = True
# Show thermal widget
show_temperature = True

View file

@ -177,6 +177,9 @@ class Kuro(BaseTheme):
Key([], "XF86MonBrightnessUp", lazy.spawn(Config.get('cmd_brightness_up', 'xbacklight -inc 10'))),
Key([], "XF86MonBrightnessDown", lazy.spawn(Config.get('cmd_brightness_down', 'xbacklight -dec 10'))),
# Screenshot key
Key([], "Print", lazy.spawn(Config.get('cmd_screenshot', 'xfce4-screenshooter'))),
# Toggle between different layouts as defined below
Key([self.mod], "Tab", lazy.next_layout()),
@ -313,12 +316,12 @@ 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.3"),
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', 1),
margin_x=1,
margin_y=1,
line_width=Config.get('visualizer_line_width', 0),
margin_x=0,
margin_y=0,
frequency=1
))
@ -392,11 +395,6 @@ class Kuro(BaseTheme):
update_delay=Config.get('battery_update_delay', 30)
),
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'),
),
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'
@ -542,13 +540,12 @@ class Kuro(BaseTheme):
@staticmethod
def update_screens(qtile):
out = utils.call_process(["xrandr", "--current"])
mode_out = utils.call_process(["optimus-manager", "--print-mode"])
if "nvidia" in mode_out:
video_mode = "nvidia"
elif "intel" in mode_out:
video_mode = "intel"
else:
video_mode = "unknown"
#mode_out = utils.call_process(["optimus-manager", "--print-mode"])
video_mode = "nvidia"
#if "nvidia" in mode_out:
# video_mode = "nvidia"
#elif "intel" in mode_out:
# video_mode = "intel"
laptop_screen = None
screens = []
for x in out.split("\n"):
@ -598,7 +595,7 @@ class Kuro(BaseTheme):
widget.update_graph()
def show_window_info(self, qtile):
window = qtile.currentWindow if qtile else None
window = qtile.current_window if qtile else None
import pprint
if window:
@ -615,7 +612,7 @@ class Kuro(BaseTheme):
# @staticmethod
def toggle_window_static(self, qtile):
window = qtile.currentWindow
window = qtile.current_window
if window in self.static_windows:
utils.notify("Unpinned {}".format(window.name), "{} has been unpinned".format(window.name))
self.static_windows.remove(window)
@ -636,7 +633,6 @@ class Kuro(BaseTheme):
p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)])
p.wait()
else:
wallpaper = None
if os.path.isfile("/home/kevin/.cache/wal/colors.json"):
with open("/home/kevin/.cache/wal/colors.json", 'r') as f:
@ -650,8 +646,11 @@ class Kuro(BaseTheme):
p = utils.execute_once("nitrogen --restore")
p.wait()
# self.log_info("Starting compositor...")
# utils.execute_once("compton -b")
self.log_info("Starting compositor...")
utils.execute_once("compton -b")
self.log_info("Starting clipboard manager...")
utils.execute_once("xfce4-clipman")
# Update color scheme
self.initialize_colorscheme()
@ -724,14 +723,14 @@ class Kuro(BaseTheme):
if not placed and isinstance(widget, kuro.utils.widgets.AudioVisualizerWidget):
if widget.client is None:
viz_info = widget.info()
pos_x = viz_info['offset'] + widget.margin_x - 1
pos_y = 0 + widget.margin_y - 1
width = viz_info['width'] - (2 * (widget.margin_x - 1))
height = viz_info['height'] - (2 * (widget.margin_y - 1))
pos_x = viz_info['offset'] + widget.margin_x
pos_y = 0 + widget.margin_y
width = viz_info['width'] - (2 * widget.margin_x)
height = viz_info['height'] - (2 * widget.margin_y)
screen_index = self.qtile.screens.index(screen)
logger.warning("Attaching {} {} to {} on screen {}".format(client, client.window.wid, type(widget).__name__, screen_index))
c = KuroStatic.create(client, screen, x=pos_x, y=pos_y, width=width, height=height)
c.setOpacity(Config.get("bar_opacity", 1.0))
c.set_opacity(Config.get("bar_opacity", 1.0))
widget.set_client(c, screen)
placed = True
if not placed:
@ -770,8 +769,8 @@ class Kuro(BaseTheme):
wallpaper_dir = Config.get("desktop_bg_folder", "")
try:
wallpapers = os.listdir(wallpaper_dir)
except os.error:
pass
except os.error as e:
logger.warning("Could not load wallpapers from directory: {}".format(e))
if wallpapers:
qtile.theme_instance.current_wallpaper = os.path.join(wallpaper_dir, random.choice(wallpapers))
@ -782,7 +781,8 @@ class Kuro(BaseTheme):
@staticmethod
def set_wallpaper(qtile, filename):
p = utils.execute_once("wal-nitrogen-noupdate {}".format(filename))
p = utils.execute_once("{} {}".format(Config.get('wallpaper_config_command', 'wal-nitrogen-noupdate'),
filename))
p.wait()
qtile.theme_instance.current_wallpaper = filename
Kuro.update_colorscheme(qtile)

View file

@ -183,6 +183,8 @@ class KuroTopBar(Bar):
super(KuroTopBar, self)._configure(qtile, screen)
self.window.handle_EnterNotify = self.handle_enter_notify
self.window.handle_LeaveNotify = self.handle_leave_notify
self.window.window.set_property("_NET_WM_NAME", "KuroTopBar")
self.window.update_name()
def draw(self):
if self.queued_draws == 0:

View file

@ -24,11 +24,11 @@ class KuroFloating(Floating):
return
if hasattr(client, "is_static_window") and client.is_static_window:
bc = client.group.qtile.colorPixel(self.border_static)
bc = client.group.qtile.color_pixel(self.border_static)
elif client.has_focus:
bc = client.group.qtile.colorPixel(self.border_focus)
bc = client.group.qtile.color_pixel(self.border_focus)
else:
bc = client.group.qtile.colorPixel(self.border_normal)
bc = client.group.qtile.color_pixel(self.border_normal)
if client.maximized:
bw = self.max_border_width
elif client.fullscreen:
@ -44,7 +44,7 @@ class KuroFloating(Floating):
except AttributeError:
# this window hasn't been placed before, let's put it in a sensible spot
transient_for = client.window.get_wm_transient_for()
win = client.group.qtile.windowMap.get(transient_for)
win = client.group.qtile.windows_map.get(transient_for)
if win is not None:
# if transient for a window, place in the center of the window
center_x = win.x + win.width / 2

View file

@ -207,6 +207,7 @@ class WifiIconWidget(base._TextBox):
('update_interval', 1, 'The update interval.'),
('theme_path', default_icon_path(), 'Path of the icons'),
('custom_icons', {}, 'dict containing key->filename icon map'),
('disconnected_message', {'error': False, 'essid': None, 'quality': 0, 'percent': 0}, 'Message to show when WiFi is disconnected'),
]
def __init__(self, **config):
@ -382,6 +383,7 @@ class MediaWidget(base.InLoopPollText):
'spotify': '',
'vlc': '',
'firefox': '',
'mpv': '',
}
custom_player_data = {
@ -574,8 +576,8 @@ class AudioVisualizerWidget(_Graph):
def update_graph(self):
if self.client is not None:
viz_info = self.info()
pos_x = viz_info['offset'] + self.margin_x - 1 + self.screen.x
pos_y = 0 + self.margin_y - 1 + self.screen.y
pos_x = viz_info['offset'] + self.margin_x + self.screen.x
pos_y = 0 + self.margin_y + self.screen.y
if self.old_position != (pos_x, pos_y):
self.old_position = (pos_x, pos_y)
@ -662,7 +664,7 @@ class KuroTaskList(TaskList):
elif window.floating:
state = self.txt_floating
markup_str = self.markup_floating
elif window is window.group.currentWindow:
elif window is window.group.current_window:
markup_str = self.markup_focused
window_name = window.name if window and window.name else "?"

View file

@ -20,7 +20,7 @@ class KuroStatic(Static):
if window.group:
window.group.remove(window)
s = KuroStatic(window.window, window.qtile, screen, x, y, width, height)
window.qtile.windowMap[window.window.wid] = s
window.qtile.windows_map[window.window.wid] = s
hook.fire("client_managed", s)
return s

View file

@ -1,2 +1,10 @@
pamixer
nitrogen
notification-daemon
otf-font-awesome
# /optional/
playerctl
xfce4-screenshooter
xfce4-clipman-plugin

View file

@ -1,3 +1,4 @@
notify2>=0.3.1
iwlib>=1.5
psutil>=5.6
pytest>=4.4