Skip to content

Commit

Permalink
fix(qtile): fix some bug
Browse files Browse the repository at this point in the history
- fix pinp func
- fix getting icon theme
  • Loading branch information
misumisumi committed Sep 28, 2024
1 parent 75099d8 commit 1d9bd99
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion apps/user/color-theme/tokyonight/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ in
shade = if flavor == "day" then "Day" else "Storm";
in
{
"wezterm/color-scheme.lua".source = ./wezterm/${flavor}.lua;
"fcitx5/conf/classicui.conf".text = lib.generators.toINIWithGlobalSection { } {
globalSection = {
Theme = "Tokyonight-${shade}";
DarkTHeme = "Tokyonight-${shade}";
};
};
"wezterm/color-scheme.lua".source = ./wezterm/${flavor}.lua;
"qtile/my_modules/colorset.py".source = ./qtile/${flavor}.py;
"dunst/dunstrc.d/00-${flavor}.dunstrc".source = "${pack}/themes/dunst/tokyonight_${flavor}.dunstrc";
};
Expand Down
11 changes: 4 additions & 7 deletions apps/user/full/wm/qtile/conf/my_modules/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

# from libqtile import widget
from libqtile import bar
from libqtile.backend.base import core
from libqtile.log_utils import logger
from qtile_extras import widget

from my_modules.colorset import ColorSet
from my_modules.variables import BarConf, FontConf, GlobalConf, WindowConf
from my_modules.variables import BarConf, FontConf, GlobalConf, IconConf, WindowConf

fc = asdict(FontConf)
ic = asdict(IconConf)


right_corner = {"decorations": [widget.decorations.PowerLineDecoration(path="rounded_right")]}
Expand Down Expand Up @@ -129,10 +129,7 @@ def sysctrl(is_tray=False):
]
if is_tray:
base += [
widget.StatusNotifier(
icon_theme="Papirus-Dark",
**left_corner,
),
widget.StatusNotifier(**ic, **left_corner),
]

return base
Expand All @@ -141,7 +138,7 @@ def sysctrl(is_tray=False):
def lifeinfo():
return [
widget.TextBox(padding=0, background=ColorSet.transparent, **right_corner),
widget.Wttr(format="%c%t/%p", location={"Yonezawa": "Yonezawa"}, **fc, **left_corner),
widget.Wttr(format="%c%t/%p", **fc, **left_corner),
widget.Clock(
format="%y-%m-%d(%a) %H:%M:%S",
foreground=ColorSet.background,
Expand Down
2 changes: 1 addition & 1 deletion apps/user/full/wm/qtile/conf/my_modules/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_pinp_size_pos(init=True):
screen_pos = (qtile.current_screen.x, qtile.current_screen.y)
pinp_size = [int(s // PinPConf.pinp_scale_down) for s in screen_size]
pinp_pos = [ss + sp - p for ss, sp, p in zip(screen_size, screen_pos, pinp_size)]
pinp_pos[0] = pinp_pos[0] - PinPConf.pinp_margin
pinp_pos[0] = pinp_pos[0] - PinPConf.margin - WindowConf.border

return pinp_size, pinp_pos

Expand Down
2 changes: 1 addition & 1 deletion apps/user/full/wm/qtile/conf/my_modules/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def set_keys():
Key([GlobalConf.mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
Key([GlobalConf.mod, "control", "shift"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
# Launch rofi
Key([GlobalConf.mod], "space", lazy.spawn("rofi -show"), desc="show rofi"),
Key([GlobalConf.mod], "space", lazy.spawn("rofi -show combi"), desc="show rofi"),
Key([GlobalConf.mod, "shift"], "space", lazy.spawn("rofi -show run"), desc="run rofi as shell mode"),
Key(
[GlobalConf.mod, "control"],
Expand Down
18 changes: 16 additions & 2 deletions apps/user/full/wm/qtile/conf/my_modules/variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This is Global config"""

import configparser
import os
import subprocess
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional, Union
Expand All @@ -18,6 +18,18 @@ class FontConfig:
fontsize: int = 16


@dataclass
class IconConfig:
icon_size: int = 16
icon_theme: Optional[str] = None

def __post_init__(self):
gtk = configparser.ConfigParser()
gtk.read(Path.home().joinpath(".config/gtk-4.0/settings.ini"))
if gtk.has_option("Settings", "gtk-icon-theme-name"):
self.icon_theme = gtk.get("Settings", "gtk-icon-theme-name")


@dataclass
class BarConfig:
size: int = 28
Expand All @@ -31,6 +43,7 @@ class BarConfig:
class PinPConfig:
scale_down: float = 3.2
margin: int = 3
pinp_scale_down: float = 3.2
target_cls_name: list[str] = field(
default_factory=lambda: [
"Picture in picture",
Expand Down Expand Up @@ -94,9 +107,10 @@ def update_monitors(self):
self.monitors_w_pentablet = utils.get_n_monitors(False)


PinPConf = PinPConfig()
FontConf = FontConfig()
IconConf = IconConfig()
BarConf = BarConfig()
PinPConf = PinPConfig()
WindowConf = WindowConfig()
GlobalConf = Global()

Expand Down
2 changes: 1 addition & 1 deletion machines/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ in
mother = settings {
hostname = "mother";
scheme = "full";
colorTheme = "tokyonight";
colorTheme = "tokyonight-storm";
inherit user;
};
zephyrus = settings {
Expand Down
6 changes: 3 additions & 3 deletions machines/mother/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xresources = {
extraConfig = "Xft.dpi:125";
};
home.pointerCursor = {
size = 32;
};
# home.pointerCursor = {
# size = 32;
# };
sops.secrets = {
"desktops" = {
path = "${config.home.homeDirectory}/.ssh/conf.d/hosts/desktops";
Expand Down

0 comments on commit 1d9bd99

Please sign in to comment.