libkookie: i3: adding compton and various improvements

wip/yesman
Katharina Fey 3 years ago
parent 76f3d25f0c
commit dceec84b00
  1. 8
      infra/libkookie/configuration/workstation/i3/tempest.nix
  2. 7
      infra/libkookie/modules/workstation/ui/i3/core/compton.conf
  3. 9
      infra/libkookie/modules/workstation/ui/i3/core/compton.nix
  4. 27
      infra/libkookie/modules/workstation/ui/i3/core/config.nix
  5. 5
      infra/libkookie/modules/workstation/ui/i3/core/i3status.nix
  6. 6
      infra/libkookie/modules/workstation/ui/i3/core/keys.nix
  7. 36
      infra/libkookie/modules/workstation/ui/i3/core/setup.nix
  8. 1
      infra/libkookie/modules/workstation/ui/i3/core/tools/default.nix
  9. 47
      infra/libkookie/modules/workstation/ui/i3/core/tools/i3-locker.nix
  10. 3
      infra/libkookie/modules/workstation/ui/i3/default.nix
  11. 5
      infra/libkookie/modules/workstation/ui/i3/hm.nix

@ -7,13 +7,15 @@
# Then configure it
libkookie.ui.i3 = {
compton = true;
# TODO: include these files via git LFS
wallpaper = /home/Pictures/Wallpapers/small-memory.webp;
# TODO: hook into the "fonts" module?
fonts = [ "Iosevka:13" ];
i3Status = {
segments = ["ipv6" "disk" "ethernet _first_" "load" "tztime local"];
};
term = pkgs.kitty;
i3Status.segments = ["ipv6" "disk" "ethernet _first_" "load" "tztime local"];
};
home.packages = with pkgs; [ iosevka ];

@ -0,0 +1,7 @@
unredir-if-possible = false;
vsync = "opengl";
### Opacity
menu-opacity = 0.90;
frame-opacity = 0.90; # i.e. titlebars, borders
inactive-opacity-override = false;

@ -0,0 +1,9 @@
{ config, lib, ... }:
let cfg = config.libkookie.ui.i3;
in
lib.mkIf cfg.compton {
text = ''
${builtins.readFile ./compton.conf}
'';
}

@ -16,6 +16,31 @@ rec {
inherit (cfg) fonts;
keybindings = (import ./keys.nix { inherit modifier;
keybindings = (import ./keys.nix { inherit cfg modifier;
pkgs = xtraPkgs; });
modes = {
# Explicitly handle the resize mode
resize = {
"h" = "resize shrink width 5 px or 5 ppt";
"j" = "resize grow height 5 px or 5 ppt";
"k" = "resize shrink height 5 px or 5 ppt";
"l" = "resize grow width 5 px or 5 ppt";
# same bindings, but for the arrow keys
"Left" = "resize shrink width 5 px or 5 ppt";
"Down" = "resize grow height 5 px or 5 ppt";
"Up" = "resize shrink height 5 px or 5 ppt";
"Right" = "resize grow width 5 px or 5 ppt";
# back to normal: Enter or Escape or $mod+r
"Return" = "mode \"default\"";
"Escape" = "mode \"default\"";
"${modifier}+r" = "mode \"default\"";
} ;
};
# The `bars` module does weird stuff so we init it ourselves
bars = [];
}

@ -4,11 +4,11 @@ let
# Grab settings from the submodule
cfg = config.libkookie.ui.i3.i3Status;
colors = (builtins.toString cfg.colors);
colors = if cfg.colors then "true" else "false";
interval = (builtins.toString cfg.interval);
# Utility functions to build the config
append = (seg: "order += ${seg}");
append = (seg: "order += \"${seg}\"");
in
with lib.mkIf;
{
@ -16,7 +16,6 @@ with lib.mkIf;
general {
colors = ${colors}
interval = ${interval}
format = ${cfg.format}
}
${lib.concatMapStringsSep "\n" (l: append l) cfg.segments}

@ -1,8 +1,9 @@
{ pkgs, modifier }:
{ cfg, pkgs, modifier }:
{
# Start a terminal
"${modifier}+Return" = "exec ${pkgs.kitty}/bin/kitty";
# TODO: this might fail
"${modifier}+Return" = "exec ${cfg.term}/bin/${cfg.term.pname}";
# Area screenshot support
"${modifier}+9" = "exec ${pkgs.libkookie-i3-scrcap}";
@ -22,6 +23,7 @@
# Rename workspaces
"${modifier}+Ctrl+r" = "exec ${pkgs.libkookie-i3-rename}";
# Move focus around - vim style
"${modifier}+h" = "focus left";
"${modifier}+t" = "focus up";

@ -16,6 +16,42 @@
enable = true;
package = pkgs.i3;
inherit config;
# TODO: move this into the config module?
extraConfig = with pkgs; ''
# Setup compton compositor
exec_always --no-startup-id "${coreutils}/bin/pkill compton; ${compton}/bin/compton --config ~/.config/i3/compton.conf"
# Make CAPSLOCK into ESC because it's 2018
#
# Okay actually this is slightly more complicated than that. I'm binding
# CAPSLOCK to HYPER, so that I can use it as a modifier in emacs, but then
# using xcape(1) to also make short CAPSLOCK presses into ESCAPE.
exec_always --no-startup-id "${xorg.xmodmap}/bin/setxkbmap -layout us -variant altgr-intl -option caps:hyper"
exec ${xcape}/bin/xcape -e "#66=Escape" -t 150
# Always set a wallpaper
# exec_always --no-startup-id ${feh}/bin/feh --bg-fill config.libkookie.ui.i3.wallpaper ?????
bar {
status_command ${i3status}/bin/i3status -c ~/.config/i3/i3status.conf
position bottom
bindsym button4 nop
bindsym button5 nop
colors {
background #0F0F0F
statusline #D5D5D5
}
}
focus_follows_mouse no
# Layout and design settings that should _really_ be in the module
default_border pixel 3
client.focused #4c7899 #285577 #ffffff #F73E5F #666666
'';
};
xdg.configFile."i3/compton.conf" = (import ./compton.nix args);

@ -5,4 +5,5 @@
libkookie-i3-switch = (import ./i3-switch.nix args);
libkookie-i3-rename = (import ./i3-rename.nix args);
libkookie-i3-scrcap = (import ./i3-scrcap.nix args);
libkookie-i3-locker = (import ./i3-locker.nix args);
}

@ -0,0 +1,47 @@
/** A utility script to lock the screen
*
* This tool relies on i3lock, ./lock.png, fortune, and imagemagic to
* create a picture to fill all available screens
*/
{ pkgs, ... }:
with pkgs;
let
lockIcon = "${i3lock-fancy}/share/i3lock-fancy/icons/lock.png";
i3lock = "${i3lock}/bin/i3lock";
mktemp = "${coreutils}/bin/mktemp";
rm = "${coreutils}/bin/rm";
fortune = "${fortune}/bin/fortune";
xrandr = "${xrandr}/bin/xrandr";
convert = "${imagemagick}/bin/convert";
in
writeShellScript "libkookie-i3locker" ''
# Create a temp directory to work in
TMPDIR=$(${mktemp} -d)
BGIMAGE=$TMPDIR/lockbg.png
FORTUNE=$(${fortune} | sed -e 's/\t/ /g')
TMPRES=$(${xrandr} | grep \* | cut -d' ' -f4 | sed ':a;N;$!ba;s/\n/ /g')
RESOLUTION=$(`echo $TMP_RES | sed 's/ /\n/g'`)
# Create a base image
${convert} -size 0x0 canvas:black $BGIMAGE
for mon in "${RESOLUTION[@]}"
do
echo "Running for monitor $mon"
TMPLOCK="$TMPDIR/tmplock.png"
${convert} -size "$mon" canvas:black -font Inconsolata -pointsize 18 \
-fill white -gravity center -annotate +0+250 "$FORTUNE" \
"${lockIcon}" -gravity center -composite "$TMPLOCK"
${convert} "$IMAGE" "$TMPLOCK" +append "$IMAGE"
${rm} "TMPLOCK"
done
# Lock the screen
${i3lock} -i "$IMAGE"
# Remove all the temp images
${rm} -rf $TMPDIR
''

@ -20,7 +20,8 @@ with lib;
type = with types; listOf str;
default = [];
description = ''
The set of video drivers to instantiate on a given system
The set of video drivers to instantiate on a given system.
This setting is passed through to the X11 configuration.
'';
};
};

@ -27,6 +27,11 @@ in
'';
};
term = mkOption {
type = types.package;
description = "Terminal emulator to bind to <M-RET>";
};
i3Status = mkOption {
type = with types; submodule {
options = {

Loading…
Cancel
Save