Skip to content

Commit

Permalink
Merge remote-tracking branch 'qc/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Sep 7, 2023
2 parents 9579ba9 + e25ffed commit cdd6160
Show file tree
Hide file tree
Showing 18 changed files with 612 additions and 84 deletions.
89 changes: 10 additions & 79 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

ecsls.url = "github:Sigmapitech-meta/ecsls";

qtile.url = "github:Sigmanificient/QtileConfig";
qtile.inputs.dotfiles.follows = "/";

home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -28,7 +25,6 @@
, home-manager
, hosts
, ecsls
, qtile
, ...
}:
let
Expand All @@ -46,7 +42,7 @@
home-manager.useUserPackages = true;
home-manager.users.${username} = import ./home;
home-manager.extraSpecialArgs = {
inherit ecsls qtile;
inherit ecsls;
conf = {
inherit username;
inherit system;
Expand Down
6 changes: 6 additions & 0 deletions home/qtile/src/autostart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh

[[ "$(hostname)" =~ 'Sigmachine' ]] \
&& xrandr --output HDMI-0 --right-of DP-1 --primary

notify-send "Welcome, $USER!" &
47 changes: 47 additions & 0 deletions home/qtile/src/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from core import autostart, floating_layout, groups, keys, layouts, mouse, screens
from widgets import widget_defaults

extension_defaults = widget_defaults.copy()

dgroups_key_binder = None
dgroups_app_rules = []
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False

auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True

# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
auto_minimize = False

# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, GitHub issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"

__all__ = (
# Hooks
"autostart",
# Keybindings
"keys",
# Mouse
"mouse",
# Workspaces groups
"groups",
# Layouts
"layouts",
"floating_layout",
# Screens
"screens",
# Widgets
"widget_defaults",
"extension_defaults",
)
23 changes: 23 additions & 0 deletions home/qtile/src/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from .groups import groups
from .hooks import autostart
from .keys import keys, mod
from .layouts import floating_layout, layouts
from .mouse import mouse
from .screens import screens

__all__ = (
# Keybindings
"keys",
"mod",
# Hooks
"autostart",
# Mouse
"mouse",
# Workspaces groups
"groups",
# Layouts
"layouts",
"floating_layout",
# Screens
"screens",
)
59 changes: 59 additions & 0 deletions home/qtile/src/core/bar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import os

from libqtile import bar, widget

from utils import Color
from widgets import (
Battery,
Clock,
CPUGraph,
GroupBox,
Memory,
Prompt,
QuickExit,
Separator,
TaskList,
Wakatime,
)


class Bar(bar.Bar):
instance_count: int = 0

widgets_checks = {
Battery: lambda _: os.uname().nodename == "Bacon",
}

_widgets = [
GroupBox,
Separator,
TaskList,
Separator,
Prompt,
Wakatime,
Battery,
Memory,
CPUGraph,
Separator,
widget.Volume,
Clock,
Separator,
QuickExit,
]

def __init__(self, id_):
self.id = id_

super().__init__(
widgets=self._build_widgets(),
size=24,
background=Color.BG_DARK.with_alpha(0.7),
margin=[0, 0, 8, 0],
)

def _build_widgets(self):
return [
widget_builder()
for widget_builder in self._widgets
if self.widgets_checks.get(widget_builder, bool)(self)
]
62 changes: 62 additions & 0 deletions home/qtile/src/core/groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from libqtile.config import DropDown, Group, Key, ScratchPad
from libqtile.lazy import lazy

from .keys import keys, mod

groups = [Group(f"{i}") for i in "ζδωχλξπσς"]
group_keys = [
"ampersand",
"eacute",
"quotedbl",
"apostrophe",
"parenleft",
"minus",
"egrave",
"underscore",
"agrave",
]

for g, key in zip(groups, group_keys):
keys.extend(
[
# mod1 + letter of group = switch to group
Key(
[mod],
key,
lazy.group[g.name].toscreen(),
desc="Switch to group {}".format(g.name),
),
Key(
[mod, "shift"],
key,
lazy.window.togroup(g.name, switch_group=True),
desc="Switch to & move focused window to group {}".format(
g.name
),
),
Key(
[mod],
"space",
lazy.group["scratchpad"].dropdown_toggle("term"),
),
]
)


groups.append(
ScratchPad(
"scratchpad",
[
DropDown(
"term",
"kitty",
x=0.05,
y=0.05,
opacity=0.95,
height=0.9,
width=0.9,
on_focus_lost_hide=False,
)
],
)
)
13 changes: 13 additions & 0 deletions home/qtile/src/core/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pathlib
import os
import subprocess

from libqtile import hook


@hook.subscribe.startup_once
def autostart():
cwd = pathlib.Path(os.path.dirname(os.path.realpath(__file__)))
autostart_path = str((cwd / ".." / "autostart.sh").absolute())

subprocess.call([autostart_path])
Loading

0 comments on commit cdd6160

Please sign in to comment.