feat: kile v2

feat/kile-v2
Ricard Illa 2023-06-04 11:34:44 +02:00
parent 9a7a73e3e0
commit 2fcb8531a0
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
5 changed files with 108 additions and 81 deletions

View File

@ -2,11 +2,11 @@
{
imports = [
./kile
./bemenu.nix
./foot.nix
./init.nix
./kanshi.nix
./kile.nix
./mako.nix
./swaybg.nix
./swaylock.nix
@ -18,7 +18,6 @@
glib
gsettings-desktop-schemas
imv
kile-wl
light
pamixer
playerctl

View File

@ -1,64 +0,0 @@
{ config, pkgs, ... }:
let
shell = "${pkgs.dash}/bin/dash";
default_master_ratio = "0.6";
up_layout = "Up ((h: v v) 1 ${default_master_ratio} 0)";
down_layout = "Down ((h: v v) 1 ${default_master_ratio} 1)";
left_layout = "Left ((v: h h) 1 ${default_master_ratio} 0)";
right_layout = "Right ((v: h h) 1 ${default_master_ratio} 1)";
deck_layout = "Deck deck";
full_layout = "Full full";
wide_layout = "Wide ((v: h h h) 1 0.5 1)";
column_layout = "Cols (v: v)";
default_layout = left_layout;
riverctl = "${pkgs.river}/bin/riverctl";
kile = "${pkgs.kile-wl}/bin/kile";
kile_namespace = "kile";
in {
systemd.user.services.kile-wl = {
Unit = {
Description = "kile layout generator";
BindsTo = [ "river-session.target" ];
};
Service = {
Type = "simple";
ExecStart =
"${kile} --namespace ${kile_namespace} --layout '${default_layout}'";
};
Install = { WantedBy = [ "river-session.target" ]; };
};
xdg.dataFile.init-kile = {
executable = true;
target = "${config.xdg.configHome}/river/init-kile";
text = ''
#!${shell}
# Super+H and Super+L to decrease/increase the main ratio
${riverctl} map -repeat normal Super Equal send-layout-cmd ${kile_namespace} "mod_main_ratio +0.01"
${riverctl} map -repeat normal Super Minus send-layout-cmd ${kile_namespace} "mod_main_ratio -0.01"
# Super+Comma and Super+Period. to increment/decrement the main count
${riverctl} map normal Super Comma send-layout-cmd ${kile_namespace} "mod_main_amount +1"
${riverctl} map normal Super Period send-layout-cmd ${kile_namespace} "mod_main_amount -1"
# Super+{Up,Right,Down,Left} to change layout orientation
${riverctl} map normal Super+Control K send-layout-cmd ${kile_namespace} "focused ${up_layout}"
${riverctl} map normal Super+Control J send-layout-cmd ${kile_namespace} "focused ${down_layout}"
${riverctl} map normal Super+Control H send-layout-cmd ${kile_namespace} "focused ${left_layout}"
${riverctl} map normal Super+Control L send-layout-cmd ${kile_namespace} "focused ${right_layout}"
${riverctl} map normal Super+Control D send-layout-cmd ${kile_namespace} "focused ${deck_layout}"
${riverctl} map normal Super+Control F send-layout-cmd ${kile_namespace} "focused ${full_layout}"
${riverctl} map normal Super+Control W send-layout-cmd ${kile_namespace} "focused ${wide_layout}"
${riverctl} map normal Super+Control C send-layout-cmd ${kile_namespace} "focused ${column_layout}"
${riverctl} map normal Super+Shift Space send-layout-cmd ${kile_namespace} "focused ${default_layout}"
${riverctl} default-layout ${kile_namespace}
'';
};
}

View File

@ -0,0 +1,72 @@
{ config, pkgs, ... }:
let
shell = "${pkgs.dash}/bin/dash";
default_master_ratio = "0.6";
up_layout = "Up ((h: v v) 1 ${default_master_ratio} 0)";
down_layout = "Down ((h: v v) 1 ${default_master_ratio} 1)";
left_layout = "Left ((v: h h) 1 ${default_master_ratio} 0)";
right_layout = "Right ((v: h h) 1 ${default_master_ratio} 1)";
deck_layout = "Deck deck";
full_layout = "Full full";
wide_layout = "Wide ((v: h h h) 1 0.5 1)";
column_layout = "Cols (v: v)";
default_layout = left_layout;
riverctl = "${pkgs.river}/bin/riverctl";
kile = "${pkgs.kile-wl}/bin/kile";
kile_namespace = "kile";
in {
home.packages = with pkgs; [ kile-wl ];
systemd.user.services.kile-wl = {
Unit = {
Description = "kile layout generator";
BindsTo = [ "river-session.target" ];
};
Service = {
Type = "simple";
ExecStart =
"${kile} --namespace ${kile_namespace}";
};
Install = { WantedBy = [ "river-session.target" ]; };
};
xdg.dataFile = {
layout = {
target = "${config.xdg.configHome}/river/layout.kl";
source = ./layout.kl;
};
init-kile = {
executable = true;
target = "${config.xdg.configHome}/river/init-kile";
text = ''
#!${shell}
# Super+H and Super+L to decrease/increase the main ratio
${riverctl} map -repeat normal Super Equal send-layout-cmd ${kile_namespace} "mod_main_ratio +0.01"
${riverctl} map -repeat normal Super Minus send-layout-cmd ${kile_namespace} "mod_main_ratio -0.01"
# Super+Comma and Super+Period. to increment/decrement the main count
${riverctl} map normal Super Comma send-layout-cmd ${kile_namespace} "mod_main_amount +1"
${riverctl} map normal Super Period send-layout-cmd ${kile_namespace} "mod_main_amount -1"
# Super+{Up,Right,Down,Left} to change layout orientation
${riverctl} map normal Super+Control K send-layout-cmd ${kile_namespace} "focused ${up_layout}"
${riverctl} map normal Super+Control J send-layout-cmd ${kile_namespace} "focused ${down_layout}"
${riverctl} map normal Super+Control H send-layout-cmd ${kile_namespace} "focused ${left_layout}"
${riverctl} map normal Super+Control L send-layout-cmd ${kile_namespace} "focused ${right_layout}"
${riverctl} map normal Super+Control D send-layout-cmd ${kile_namespace} "focused ${deck_layout}"
${riverctl} map normal Super+Control F send-layout-cmd ${kile_namespace} "focused ${full_layout}"
${riverctl} map normal Super+Control W send-layout-cmd ${kile_namespace} "focused ${wide_layout}"
${riverctl} map normal Super+Control C send-layout-cmd ${kile_namespace} "focused ${column_layout}"
${riverctl} map normal Super+Shift Space send-layout-cmd ${kile_namespace} "focused ${default_layout}"
${riverctl} default-layout ${kile_namespace}
'';
};
};
}

View File

@ -0,0 +1,8 @@
const ver Vertical
const hor Horizontal
const vsplit (ver | hor ([1 - 0.5] *hsplit))
const hsplit (hor | ver ([1 - 0.5] *vsplit))
# Preview
const default vsplit

View File

@ -18,27 +18,39 @@
# })
(self: super: {
# get latest version of kile-wl for compatibility with river's latest version
kile-wl = super.kile-wl.overrideAttrs (old: rec {
version = "2023-04-13";
kile-wl = super.rustPlatform.buildRustPackage rec {
pname = "kile-wl";
version = "v2-2023-05-19";
src = super.fetchFromGitLab {
owner = "snakedye";
repo = "kile";
rev = "d5b6c1fd0f260e823e08811dae202e9394037c43";
sha256 = "sha256-bWtuLSw4e57YOjdzbY7yobbe4kp67YzG15nhNce3pxA=";
rev = "625f91010b920587dbf0ee23113eb8aa51cc6ec3";
sha256 = "sha256-4sfzF2g2kSz+Q55gTCePjM+7kvfrEJ2uLKyy/V+SLF4=";
};
cargoDeps = old.cargoDeps.overrideAttrs (_: {
inherit src;
outputHash = "sha256-yXIW1/KHmUS9ubRYI8nAKD2VZaQ+vCyCBhm788pLpwA=";
});
});
cargoLock = {
lockFile = src + "/Cargo.lock";
outputHashes = {
"kilexpr-0.1.0" =
"sha256-wclffEkPr1rIYdeRTIb1FZhMbX5LhLy8yB0qMEDmx0k=";
};
};
meta = with super.lib; {
description = "A tiling layout generator for river";
homepage = "https://gitlab.com/snakedye/kile";
license = licenses.mit;
platforms =
platforms.linux; # It's meant for river, a wayland compositor
mainProgram = "kile";
};
};
})
# I need the stable version of river to keep it compatible with kile
# (self: super: { river = stablePkgs.river; })
# these packages seem to be broken on the unstable channel, so I'm using
# the stable versions for now
# These packages seem to be broken on the unstable channel, so I'm using
# the stable versions for now. Currently this is not happening for any
# package that I use :)
];
# Let Home Manager install and manage itself.