swayosd flake, better multihead

This commit is contained in:
atagen 2024-01-13 01:53:30 +11:00
parent a45ac1792c
commit 7882fe6841
9 changed files with 266 additions and 68 deletions

1
TODO Normal file
View file

@ -0,0 +1 @@
finish swayosd services setup

View file

@ -49,6 +49,11 @@
url = "path:flakes/qtile";
inputs.nixpkgs.follows = "nixpkgs";
};
swayosd = {
url = "path:flakes/swayosd";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
@ -59,6 +64,7 @@
nur,
helix,
qtile,
swayosd,
nixd,
nix-ld-rs,
nix-index-database,

View file

@ -1,67 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
kile-src = {
url = "gitlab:snakedye/kile";
flake = false;
};
};
outputs = {
self,
nixpkgs,
crane,
flake-utils,
kile-src,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
# import nixpkgs {
# inherit system;
# };
craneLib = crane.lib.${system};
kile = craneLib.buildPackage {
src = kile-src;
buildInputs = with pkgs; [
wayland
];
# Additional environment variables can be set directly
# MY_CUSTOM_VAR = "some value";
};
in {
checks = {
inherit kile;
};
packages.default = kile;
apps.default = flake-utils.lib.mkApp {
drv = kile;
};
devShells.default = craneLib.devShell {
# Inherit inputs from checks.
checks = self.checks.${system};
# Additional dev-shell environment variables can be set directly
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
# Extra inputs can be added here; cargo and rustc are provided by default.
packages = [
# pkgs.ripgrep
];
};
});
}

147
flakes/swayosd/flake.lock generated Normal file
View file

@ -0,0 +1,147 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704722960,
"narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"swayosd-src": "swayosd-src"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1705025860,
"narHash": "sha256-9vcqo5CJLOHU63S7pVlP0u4OhgJxrXebQR4vqMPXLRg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d458975da373a37422577886566fce8201bc1254",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"swayosd-src": {
"flake": false,
"locked": {
"lastModified": 1702248404,
"narHash": "sha256-3NJHZv4Ed7haUUmE9JV9Yl4rRnJlPqQFv53Xuw0q+IY=",
"owner": "ErikReider",
"repo": "SwayOSD",
"rev": "a0709bcd89d6ca19889486972bac35e69f1fa8e4",
"type": "github"
},
"original": {
"owner": "ErikReider",
"repo": "SwayOSD",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

71
flakes/swayosd/flake.nix Normal file
View file

@ -0,0 +1,71 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
swayosd-src = {
url = "github:ErikReider/SwayOSD";
flake = false;
};
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = inputs @ {
self,
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
in
with pkgs; {
packages.default = stdenv.mkDerivation {
pname = "swayosd";
version = "unstable-${inputs.swayosd-src.lastModifiedDate}";
src = inputs.swayosd-src;
cargoDeps = rustPlatform.importCargoLock {
lockFile = "${inputs.swayosd-src}/Cargo.lock";
};
nativeBuildInputs = [
wrapGAppsHook
pkg-config
meson
ninja
glib
sassc
rustPlatform.cargoSetupHook
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))
];
buildInputs = [
gtk-layer-shell
libevdev
libinput
libpulseaudio
udev
systemd
];
patches = [
./systemd.patch
];
postPatch = ''
substituteInPlace data/udev/99-swayosd.rules \
--replace /bin/chgrp ${coreutils}/bin/chgrp \
--replace /bin/chmod ${coreutils}/bin/chmod
'';
};
}
);
}

View file

@ -0,0 +1,18 @@
diff --git a/data/meson.build b/data/meson.build
index fc687a5..68decdf 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -41,11 +42,7 @@ configure_file(
# Systemd service unit
systemd = dependency('systemd', required: false)
-if systemd.found()
- systemd_service_install_dir = systemd.get_variable(pkgconfig :'systemdsystemunitdir')
-else
- systemd_service_install_dir = join_paths(libdir, 'systemd', 'system')
-endif
+systemd_service_install_dir = join_paths(libdir, 'systemd', 'system')
configure_file(
configuration: conf_data,

View file

@ -101,8 +101,15 @@ keys = [
Key([mod], "space", lazy.window.toggle_floating()),
Key([mod, "shift"], "space", lazy.window.toggle_fullscreen()),
Key([mod], "Tab", lazy.next_screen()),
Key([mod, "shift"], "Tab", lazy.function(send_to_next_screen())),
]
def send_to_next_screen() -> Callable:
def _inner(qtile: Qtile) -> None:
win = qtile.current_window
win.toscreen(1 if qtile.current_screen == 0 else 0)
return _inner
groups = []
land_groups = "123"
port_groups = "456"
@ -313,3 +320,5 @@ def centre_floated():
# logger.warning(client.opacity)
# client.rounding = 8
# client.opacity = 0.85
qtile.focus_screen(1)

View file

@ -16,6 +16,7 @@ in {
./programs/wlogout.nix
./programs/fuzzel.nix
./programs/qtile.nix
./programs/swayosd.nix
./programs/swaync.nix
./programs/firefox.nix
./programs/kitty.nix
@ -55,7 +56,7 @@ in {
xorg.xrdb
culr
swayosd
inputs.swayosd
# kdeconnect
keepassxc

12
home/programs/swayosd.nix Normal file
View file

@ -0,0 +1,12 @@
{
config,
lib,
pkgs,
swayosd,
...
}:
{
config.ezServices = {
swayosd = "${lib.getExe' swayosd "swayosd-server" }";
}
}