diff --git a/infra/libkookie/configuration/workstation/i3/tempest.nix b/infra/libkookie/configuration/workstation/i3/tempest.nix index 6d52af7aa11..616a8a3de86 100644 --- a/infra/libkookie/configuration/workstation/i3/tempest.nix +++ b/infra/libkookie/configuration/workstation/i3/tempest.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"]; }; diff --git a/infra/libkookie/modules/workstation/ui/i3/core/config.nix b/infra/libkookie/modules/workstation/ui/i3/core/config.nix index 6cb37916540..2e47da45494 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/config.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/config.nix @@ -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 diff --git a/infra/libkookie/modules/workstation/ui/i3/core/default.nix b/infra/libkookie/modules/workstation/ui/i3/core/default.nix index 0472aeebc2d..bc74e161212 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/default.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/default.nix @@ -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; }; } diff --git a/infra/libkookie/modules/workstation/ui/i3/core/keys.nix b/infra/libkookie/modules/workstation/ui/i3/core/keys.nix index 491e66fdaaa..5ca47f03500 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/keys.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/keys.nix @@ -19,7 +19,10 @@ "${modifier}+f" = "fullscreen"; # Start software on or 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}"; diff --git a/infra/libkookie/modules/workstation/ui/i3/core/setup.nix b/infra/libkookie/modules/workstation/ui/i3/core/setup.nix index 3da4c10e987..b86b1c5d3d0 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/setup.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/setup.nix @@ -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); diff --git a/infra/libkookie/modules/workstation/ui/i3/core/tools/default.nix b/infra/libkookie/modules/workstation/ui/i3/core/tools/default.nix index 1196dc28c46..0603153689b 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/tools/default.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/tools/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... } @ args: +{ bottom, pkgs, ... } @ args: { libkookie-i3-move = (import ./i3-move.nix args); diff --git a/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-move.nix b/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-move.nix index 94f92149adf..256386ed54e 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-move.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-move.nix @@ -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 diff --git a/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix b/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix index 4e1cd4dd53a..d44b1291360 100644 --- a/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix +++ b/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix @@ -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 + '' diff --git a/infra/libkookie/modules/workstation/ui/i3/default.nix b/infra/libkookie/modules/workstation/ui/i3/default.nix index a079fa0fb3f..ca92f04ff64 100644 --- a/infra/libkookie/modules/workstation/ui/i3/default.nix +++ b/infra/libkookie/modules/workstation/ui/i3/default.nix @@ -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); diff --git a/infra/libkookie/modules/workstation/ui/i3/hm.nix b/infra/libkookie/modules/workstation/ui/i3/hm.nix index 7a7a8676fa5..602aa67d3e9 100644 --- a/infra/libkookie/modules/workstation/ui/i3/hm.nix +++ b/infra/libkookie/modules/workstation/ui/i3/hm.nix @@ -42,6 +42,18 @@ in type = types.package; description = "Terminal emulator to bind to "; }; + + 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 {