libkookie: i3: enable switching between i3 and i3-gaps

Unfortunately it's important to switch both the NixOS libkookie.i3
module _and_ home-manager libkookie.i3 module and it's not really easy
to synchronise those two states.

Nonetheless, the home-manager module now also makes the status bar
location configurable.  Hurray!
main
Katharina Fey 2 years ago
parent 0622395338
commit cf491794a7
Signed by: kookie
GPG Key ID: 90734A9E619C8A6C
  1. 5
      infra/libkookie/configuration/workstation/i3/tempest.nix
  2. 3
      infra/libkookie/modules/workstation/ui/i3/core/config.nix
  3. 23
      infra/libkookie/modules/workstation/ui/i3/core/default.nix
  4. 5
      infra/libkookie/modules/workstation/ui/i3/core/keys.nix
  5. 73
      infra/libkookie/modules/workstation/ui/i3/core/setup.nix
  6. 2
      infra/libkookie/modules/workstation/ui/i3/core/tools/default.nix
  7. 11
      infra/libkookie/modules/workstation/ui/i3/core/tools/i3-move.nix
  8. 20
      infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix
  9. 6
      infra/libkookie/modules/workstation/ui/i3/default.nix
  10. 12
      infra/libkookie/modules/workstation/ui/i3/hm.nix

@ -9,7 +9,7 @@
picom = true;
# TODO: include these files via git LFS
wallpaper = /home/Pictures/Wallpapers/small-memory.webp;
wallpaper = /home/Pictures/Wallpapers/transistor1.jpg;
# TODO: hook into the "fonts" module?
fonts = [ "Iosevka Kookie:13" ];
@ -17,6 +17,9 @@
networkmanager = false;
term = pkgs.kitty;
window-spacing = true;
bar-location = "top";
i3Status.segments = ["ipv6" "disk /" "ethernet _first_" "load" "tztime local"];
};

@ -8,7 +8,8 @@
let
cfg = config.libkookie.ui.i3;
xtraPkgs = pkgs // (import ./tools args);
bottom = cfg.bar-location == "bottom";
xtraPkgs = pkgs // (import ./tools (args // { inherit bottom; }));
in
rec {
# This is not configurable by design

@ -1,6 +1,10 @@
{ lib, config, pkgs, ... }:
let cfg = config.libkookie.ui.i3;
in
{
environment.systemPackages = [ pkgs.gnome3.file-roller ];
# Set the basic xfce/xserver configuration
services.xserver = {
enable = true;
@ -9,10 +13,23 @@
enable = true;
noDesktop = true;
enableXfwm = false;
thunarPlugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
thunar-media-tags-plugin
];
};
};
displayManager.defaultSession = "xfce+i3";
windowManager.i3.enable = true;
displayManager = {
gdm.enable = true;
defaultSession = "xfce+i3";
};
windowManager.i3 = {
enable = true;
package = with pkgs; if cfg.window-spacing then i3-gaps else i3;
};
useGlamor = true;
@ -34,7 +51,7 @@
SDL2 SDL2_gfx SDL2_mixer SDL2_ttf
];
extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
driSupport32Bit = true;
# driSupport32Bit = true; ## broken by Manjaro kernel
setLdLibraryPath = true;
};
}

@ -19,7 +19,10 @@
"${modifier}+f" = "fullscreen";
# Start software on <this> or <other> workspace
"${modifier}+e" = "exec ${pkgs.dmenu}/bin/dmenu_run";
"${modifier}+e" = if cfg.bar-location == "top" then
"exec ${pkgs.dmenu}/bin/dmenu_run -b"
else
"exec ${pkgs.dmenu}/bin/dmenu_run";
# Switch to workspace (optionally take current window)
"${modifier}+o" = "exec ${pkgs.libkookie-i3-switch}";

@ -29,7 +29,7 @@ in
in
{
enable = true;
package = pkgs.i3;
package = if cfg.window-spacing then pkgs.i3-gaps else pkgs.i3;
inherit config;
# TODO: move this into the config module?
@ -38,39 +38,46 @@ in
let
fehCommand = "${feh}/bin/feh --bg-fill ${cfg.wallpaper}";
in
''
# Setup compositor
exec_always --no-startup-id "${coreutils}/bin/pkill picom; ${picom}/bin/picom --config ~/.config/i3/picom.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 ${fehCommand}
bar {
status_command ${i3status}/bin/i3status -c ~/.config/i3/i3status.conf
position bottom
bindsym button4 nop
bindsym button5 nop
colors {
background #0F0F0F
statusline #D5D5D5
''
# Setup compositor
exec_always --no-startup-id "${coreutils}/bin/pkill picom; ${picom}/bin/picom --config ~/.config/i3/picom.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 ${fehCommand}
bar {
status_command ${i3status}/bin/i3status -c ~/.config/i3/i3status.conf
position top
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
'';
focus_follows_mouse no
# Layout and design settings that should _really_ be in the module
# default_border none
client.focused #4c7899 #285577 #ffffff #F73E5F #666666
'' + (if cfg.window-spacing then
''
# These settings are for i3-gaps
for_window [class=".*"] border pixel 3
gaps inner 20
''
else
"");
};
xdg.configFile."i3/picom.conf" = (import ./picom.nix args);

@ -1,4 +1,4 @@
{ pkgs, ... } @ args:
{ bottom, pkgs, ... } @ args:
{
libkookie-i3-move = (import ./i3-move.nix args);

@ -5,11 +5,16 @@
* (dmenu) could be made configurable, so not to rely on nazi code.
*/
{ pkgs, ... }: with pkgs; writeShellScript "libkookie-i3-move" ''
{ bottom, pkgs, ... }: with pkgs;
let dmenu-cmd = if bottom then
"${dmenu}/bin/dmenu -b -i \"$@\""
else
"${dmenu}/bin/dmenu -i \"$@\"";
in
writeShellScript "libkookie-i3-move" ''
WS=$(${i3}/bin/i3-msg -t get_workspaces | \
${jq}/bin/jq -r -M '.[] | .name' | sort -u | \
${dmenu}/bin/dmenu -b -i "$@")
${dmenu-cmd})
${i3}/bin/i3-msg -t command move workspace $WS
${i3}/bin/i3-msg workspace $WS

@ -5,11 +5,17 @@
* could be made configurable, so not to rely on nazi code.
*/
{ pkgs, ... }: with pkgs; writeShellScript "libkookie-i3-switch" ''
{ bottom, pkgs, ... }: with pkgs;
let dmenu-cmd = if bottom then
"${dmenu}/bin/dmenu -b -i \"$@\""
else
"${dmenu}/bin/dmenu -i \"$@\"";
in
WS=$(${i3}/bin/i3-msg -t get_workspaces | \
${jq}/bin/jq -r -M '.[] | .name' | sort -u | \
${dmenu}/bin/dmenu -b -i "$@")
${i3}/bin/i3-msg workspace $WS
''
writeShellScript "libkookie-i3-switch" ''
WS=$(${i3}/bin/i3-msg -t get_workspaces | \
${jq}/bin/jq -r -M '.[] | .name' | sort -u | \
${dmenu-cmd})
${i3}/bin/i3-msg workspace $WS
''

@ -24,6 +24,12 @@ with lib;
This setting is passed through to the X11 configuration.
'';
};
window-spacing = mkOption {
type = types.bool;
default = false;
description = "Enable window spacing via i3gaps";
};
};
config = mkIf cfg.enable (import ./core args);

@ -42,6 +42,18 @@ in
type = types.package;
description = "Terminal emulator to bind to <M-RET>";
};
bar-location = mkOption {
type = types.enum [ "top" "bottom" ];
default = "bottom";
description = "Choose the orientation of the status bar";
};
window-spacing = mkOption {
type = types.bool;
default = false;
description = "Enable window spacing via i3gaps";
};
i3Status = mkOption {
type = with types; submodule {

Loading…
Cancel
Save