From 088418304323bbbdaf0493c5ffe02cc2c31f84aa Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Fri, 3 Feb 2023 17:41:33 +0100 Subject: [PATCH] added things for river desktop --- home/desktop-river/default.nix | 6 ++-- home/desktop-river/foot.nix | 14 +++++--- home/desktop-river/init | 61 +++++++++++++++++++++++++--------- home/desktop-river/kanshi.nix | 14 ++++++++ home/nixos-common.nix | 20 +++++++++++ 5 files changed, 93 insertions(+), 22 deletions(-) diff --git a/home/desktop-river/default.nix b/home/desktop-river/default.nix index bb1dcad..c7f5c48 100644 --- a/home/desktop-river/default.nix +++ b/home/desktop-river/default.nix @@ -28,11 +28,12 @@ in { configure-gtk glib gsettings-desktop-schemas + kile-wl light + mpdris2 pamixer playerctl river - kile-wl swaybg wl-clipboard wtype @@ -40,11 +41,12 @@ in { ]; programs.zsh.loginExtra = '' - [[ -z "''${DISPLAY}" ]] && [[ "$(tty)" = "/dev/tty1" ]] && \ + if [[ -z "''${DISPLAY}" ]] && [[ "''${XDG_VTNR}" -eq 1 ]]; then export XKB_DEFAULT_LAYOUT="us" export XKB_DEFAULT_VARIANT="altgr-intl" export XKB_DEFAULT_OPTIONS="caps:escape" exec ${pkgs.river}/bin/river + fi ''; home.file.river_init = { diff --git a/home/desktop-river/foot.nix b/home/desktop-river/foot.nix index 609ab3c..1604907 100644 --- a/home/desktop-river/foot.nix +++ b/home/desktop-river/foot.nix @@ -1,15 +1,19 @@ { config, pkgs, ... }: -{ +let + font-name = "Hack Nerd Font"; + font-size = "10"; +in { programs.foot = { enable = true; settings = { main = { shell = "${pkgs.tmux}/bin/tmux -u"; - font = "Hack Nerd Font:size=8:style=Regular"; - font-bold = "Hack Nerd Font:size=8:style=Bold"; - font-italic = "Hack Nerd Font:size=8:style=Italic"; - font-bold-italic = "Hack Nerd Font:size=8:style=Bold Italic"; + font = "${font-name}:size=${font-size}:style=Regular"; + font-bold = "${font-name}:size=${font-size}:style=Bold"; + font-italic = "${font-name}:size=${font-size}:style=Italic"; + font-bold-italic = "${font-name}:size=${font-size}:style=Bold Italic"; + dpi-aware = "no"; }; colors = { alpha = 0.9; diff --git a/home/desktop-river/init b/home/desktop-river/init index 2f06644..a5fc2dc 100644 --- a/home/desktop-river/init +++ b/home/desktop-river/init @@ -2,6 +2,17 @@ WALLPAPERS="$HOME/Images/wallpapers/enabled" +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)" + +DEFAULT_LAYOUT=$LEFT_LAYOUT + # Super+Return to start an instance of foot (https://codeberg.org/dnkl/foot) riverctl map normal Super Return spawn foot @@ -36,13 +47,17 @@ riverctl map normal Super+Shift W send-to-output previous # Super+Shift+Return to bump the focused view to the top of the layout stack riverctl map normal Super+Shift Return zoom -# Super+H and Super+L to decrease/increase the main ratio of rivertile(1) -riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05" -riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05" +# Super+H and Super+L to decrease/increase the main ratio +# riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05" +# riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05" +riverctl map -repeat normal Super H send-layout-cmd kile "mod_main_ratio +0.01" +riverctl map -repeat normal Super L send-layout-cmd kile "mod_main_ratio -0.01" -# Super+Shift+Comma and Super+Shift+Period. to increment/decrement the main count of rivertile(1) -riverctl map normal Super+Shift Comma send-layout-cmd rivertile "main-count +1" -riverctl map normal Super+Shift Period send-layout-cmd rivertile "main-count -1" +# Super+Comma and Super+Period. to increment/decrement the main count +# riverctl map normal Super Comma send-layout-cmd rivertile "main-count +1" +# riverctl map normal Super Period send-layout-cmd rivertile "main-count -1" +riverctl map normal Super+Shift H send-layout-cmd kile "mod_main_amount +1" +riverctl map normal Super+Shift L send-layout-cmd kile "mod_main_amount -1" # Super+Alt+{H,J,K,L} to move views riverctl map normal Super+Alt H move left 100 @@ -101,10 +116,19 @@ riverctl map normal Super T toggle-float riverctl map normal Super M toggle-fullscreen # Super+{Up,Right,Down,Left} to change layout orientation -riverctl map normal Super Up send-layout-cmd rivertile "main-location top" -riverctl map normal Super Right send-layout-cmd rivertile "main-location right" -riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" -riverctl map normal Super Left send-layout-cmd rivertile "main-location left" +# riverctl map normal Super Up send-layout-cmd rivertile "main-location top" +# riverctl map normal Super Right send-layout-cmd rivertile "main-location right" +# riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" +# riverctl map normal Super Left send-layout-cmd rivertile "main-location left" +# +riverctl map normal Super+Control K send-layout-cmd kile "focused $UP_LAYOUT" +riverctl map normal Super+Control J send-layout-cmd kile "focused $DOWN_LAYOUT" +riverctl map normal Super+Control H send-layout-cmd kile "focused $LEFT_LAYOUT" +riverctl map normal Super+Control L send-layout-cmd kile "focused $RIGHT_LAYOUT" +riverctl map normal Super+Control D send-layout-cmd kile "focused $DECK_LAYOUT" +riverctl map normal Super+Control F send-layout-cmd kile "focused $FULL_LAYOUT" +riverctl map normal Super+Control W send-layout-cmd kile "focused $WIDE_LAYOUT" +riverctl map normal Super+Shift Space send-layout-cmd kile "focused $DEFAULT_LAYOUT" # Declare a passthrough mode. This mode has only a single mapping to return to # normal mode. This makes it useful for testing a nested wayland compositor @@ -165,15 +189,22 @@ riverctl spawn "configure-gtk" BG="$(find "$WALLPAPERS" -type f | shuf -n 1)" riverctl spawn "swaybg --image $BG --mode fill" -trackball_name="pointer-21298-5120-Clearly_Superior_Technologies._CST_Laser_Trackball" -riverctl input "$trackball_name" left-handed enabled -riverctl input "$trackball_name" pointer-accel -0.8 +trackball_names="pointer-21298-5120-Clearly_Superior_Technologies._CST_Laser_Trackball 21298:5120:Clearly_Superior_Technologies._CST_Laser_Trackball" +for name in $trackball_names; do + echo "$name" + riverctl input "$name" left-handed enabled + riverctl input "$name" pointer-accel -0.8 +done # Set the default layout generator to be rivertile and start it. # River will send the process group of the init executable SIGTERM on exit. -riverctl default-layout rivertile -rivertile -view-padding 0 -outer-padding 0 & +# riverctl default-layout rivertile +# rivertile -view-padding 0 -outer-padding 0 & + +riverctl default-layout kile +kile --namespace kile --layout "$DEFAULT_LAYOUT" & kanshi & gotify-desktop & nm-applet --indicator & +mpDris2 & diff --git a/home/desktop-river/kanshi.nix b/home/desktop-river/kanshi.nix index fe90c74..6546aaf 100644 --- a/home/desktop-river/kanshi.nix +++ b/home/desktop-river/kanshi.nix @@ -25,6 +25,20 @@ } ]; }; + + docked2 = { + outputs = [ + { + criteria = "LVDS-1"; + status = "disable"; + } + { + criteria = "BenQ Corporation BenQ GW2780 L9K0033101Q"; + mode = "1920x1080@60Hz"; + } + ]; + }; + }; }; } diff --git a/home/nixos-common.nix b/home/nixos-common.nix index a134c5b..1650b90 100644 --- a/home/nixos-common.nix +++ b/home/nixos-common.nix @@ -14,6 +14,26 @@ }; }); }) + + (self: super: { + # get latest version of kile-wl for compatibility with river's latest version + kile-wl = super.kile-wl.overrideAttrs (old: rec { + version = "latest"; + src = super.fetchFromGitLab { + owner = "snakedye"; + repo = "kile"; + rev = "d5ab8483c4c8bae6b3a704b87ccc26bae21dca07"; + sha256 = "sha256-q8jpC2FZ+pj/5bOn7pugka/RlXOfegXelpCn+kRqEdo="; + }; + cargoDeps = old.cargoDeps.overrideAttrs (_: { + inherit src; + outputHash = "sha256-yXIW1/KHmUS9ubRYI8nAKD2VZaQ+vCyCBhm788pLpwA="; + }); + }); + }) + + (self: super: { river = stablePkgs.river; }) + ]; # Let Home Manager install and manage itself.