switch to avizo for xf86 buttons

This commit is contained in:
atagen 2024-01-25 01:30:13 +11:00
parent 2e186237ee
commit 9c40a693e8
9 changed files with 151 additions and 224 deletions

View file

@ -4,6 +4,7 @@ ckb-next -c -b &
mullvad connect &
xrdb -l ~/.Xresources &
wlr-randr --output HDMI-A-1 --transform 90
wlr-randr --output DP-1 --pos 1080,450 --adaptive-sync enabled
# for later..
# gsettings set org.gnome.desktop.interface gtk-theme '${rice.gtk-theme.name}'";}

View file

@ -14,6 +14,8 @@ from libqtile.backend import base
from libqtile.lazy import lazy
from libqtile.config import Key, Match, Screen, Click, Drag, Group, ScratchPad, DropDown, Screen
from lib import centre_float, go_to_group, send_to_next_screen
# from smartfloat import SmartFloat
# import qtile_extras.widget as extra_widgets
@ -25,6 +27,7 @@ from libqtile.core.manager import Qtile
from libqtile.backend.wayland import InputConfig
wl_input_rules = {
"type:keyboard": InputConfig(kb_options="caps:escape"),
"*": InputConfig(accel_profile="flat", pointer_accel=0.0),
@ -47,14 +50,22 @@ class Apps:
class OSD:
mute = "swayosd --output-volume mute-toggle"
vol_up = "swayosd --output-volume raise"
vol_down = "swayosd --output-volume lower"
vol_up = "volumectl -u up"
vol_down = "volumectl -u down"
# vol_up = "pactl set-sink-volume @DEFAULT_SINK@ +5% && notify-send \"Audio Volume\" \"$(pactl get-sink-volume @DEFAULT_SINK@ | cut -d' ' -f 6)\""
# vol_down = "pactl set-sink-volume @DEFAULT_SINK@ -5% && notify-send \"Audio Volume\" \"$(pactl get-sink-volume @DEFAULT_SINK@ | cut -d' ' -f 6)\""
# vol_up = "swayosd --output-volume raise"
# vol_down = "swayosd --output-volume lower"
next = "playerctl next"
prev = "playerctl previous"
stop = "playerctl stop"
play = "playerctl play-pause"
brightup = "swayosd --brightness raise"
brightdown = "swayosd --brightness lower"
brightup = "lightctl up"
brightdown = "lightctl down"
# brightup = "brightnessctl +5%"
# brightdown = "brightnessctl -5%"
# brightup = "swayosd --brightness raise"
# brightdown = "swayosd --brightness lower"
keys = [
@ -103,44 +114,17 @@ keys = [
Key([mod], "Tab", lazy.next_screen()),
]
def send_to_next_screen() -> Callable:
def _inner(qtile: Qtile) -> None:
win = qtile.current_window
if win is not None:
screen_to_send = (qtile.current_screen.index+1)%2
win.toscreen(screen_to_send)
qtile.focus_screen(screen_to_send)
if win.floating:
win.bring_to_front()
info = qtile.current_screen.info()
width, height = ((info["width"] // 4) * 3, (info["height"] // 6) * 5)
win.set_size_floating(width, height)
win.center()
return _inner
keys.append(
Key([mod, "shift"], "Tab", lazy.function(send_to_next_screen()))
)
groups = []
land_groups = "123"
port_groups = "456"
groups.extend([Group(i, screen_affinity=1) for i in land_groups])
groups.extend([Group(i, screen_affinity=0) for i in port_groups])
def go_to_group(name: str) -> Callable:
def _inner(qtile: Qtile) -> None:
if len(qtile.screens) ==1:
qtile.groups_map[name].toscreen()
return
if name in land_groups:
qtile.focus_screen(1)
qtile.groups_map[name].toscreen()
else:
qtile.focus_screen(0)
qtile.groups_map[name].toscreen()
return _inner
land_groups = "135"
port_groups = "246"
groups.extend([Group(str(i), screen_affinity=(i+1)%2) for i in range(1,7)])
# groups.extend([Group(i, screen_affinity=1) for i in land_groups])
# groups.extend([Group(i, screen_affinity=0) for i in port_groups])
for i in groups:
keys.extend(
@ -149,7 +133,7 @@ for i in groups:
Key(
[mod],
i.name,
lazy.function(go_to_group(i.name)),
lazy.function(go_to_group(land_groups, port_groups, i.name)),
# lazy.group[i.name].toscreen(),
desc="Switch to group {}".format(i.name),
),
@ -220,8 +204,8 @@ layout_theme = dict(
)
layouts = [
layout.Bsp(fair=False, border_on_single=True, **layout_theme),
# layout.SmartFloat(**layout_theme),
layout.Bsp(fair=False, margin_on_single=#SINGLE_GAP, border_on_single=True, **layout_theme),
# layout.SmartFloat(**layout_theme),
]
widget_defaults = dict(
@ -317,12 +301,7 @@ def centre_floated():
and not win.wants_to_fullscreen
and not win.fullscreen
):
win.bring_to_front()
info = qtile.current_screen.info()
width, height = ((info["width"] // 4) * 3, (info["height"] // 6) * 5)
win.set_size_floating(width, height)
win.center()
qtile.function(centre_float(win, 1.0/6.0*5.0, 1.0/8.0*7.0))
# @hook.subscribe.client_new
# def round_and_transparent(client):
@ -332,5 +311,3 @@ def centre_floated():
# logger.warning(client.opacity)
# client.rounding = 8
# client.opacity = 0.85
qtile.focus_screen(1)

53
home/dots/qtile/lib.py Normal file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env python3
from __future__ import annotations
from typing import Callable
from libqtile.log_utils import logger
from libqtile.core.manager import Qtile
def centre_float(win, greater: float, lesser: float) -> Callable:
def _inner(qtile: Qtile) -> None:
win.bring_to_front()
info = qtile.current_screen.info()
width = info["width"]
height = info["height"]
if height > width:
width, height = (width*lesser, height*greater)
else:
width, height = (width*greater, height*lesser)
win.set_size_floating(int(width), int(height))
win.center()
return _inner
def go_to_group(land_groups: str, port_groups: str, name: str) -> Callable:
def _inner(qtile: Qtile) -> None:
if len(qtile.screens) == 1:
qtile.groups_map[name].toscreen()
return
if name in land_groups:
qtile.focus_screen(1)
qtile.groups_map[name].toscreen()
elif name in port_groups:
qtile.focus_screen(0)
qtile.groups_map[name].toscreen()
return _inner
def send_to_next_screen() -> Callable:
def _inner(qtile: Qtile) -> None:
win = qtile.current_window
if win is not None:
screen_to_send = (qtile.current_screen.index+1)%len(qtile.get_screens())
win.toscreen(screen_to_send)
qtile.focus_screen(screen_to_send)
if (
win.floating
and not win.maximized
and not win.wants_to_fullscreen
and not win.fullscreen
):
qtile.function(centre_float(win, 1.0/6.0*5.0, 1.0/8.0*7.0))
return _inner