diff --git a/config/nix/curacao.nix b/config/nix/curacao.nix index 6dc088d..9b389a1 100644 --- a/config/nix/curacao.nix +++ b/config/nix/curacao.nix @@ -7,4 +7,5 @@ networking.hostName = "curacao"; frogeye.extra = true; + frogeye.desktop.xorg = true; } diff --git a/config/nix/curacao_test.nix b/config/nix/curacao_test.nix index ecb1b16..815e13d 100644 --- a/config/nix/curacao_test.nix +++ b/config/nix/curacao_test.nix @@ -8,5 +8,6 @@ home.homeDirectory = "/home/gnix"; frogeye.extra = true; + frogeye.desktop.xorg = true; frogeye.desktop.nixGLIntel = true; } diff --git a/config/nix/hm/common.nix b/config/nix/hm/common.nix index 661885e..e839ae9 100644 --- a/config/nix/hm/common.nix +++ b/config/nix/hm/common.nix @@ -465,23 +465,28 @@ in # Favourite commands PAGER = "${pkgs.coreutils}/bin/less"; EDITOR = "${pkgs.neovim}/bin/nvim"; - VISUAL = "${pkgs.neovim}/bin/nvim"; - BROWSER = "${config.programs.qutebrowser.package}/bin/qutebrowser"; - } // direnv // { + + # Extra config BOOT9_PATH = "${config.xdg.dataHome}/citra-emu/sysdata/boot9.bin"; CCACHE_CONFIGPATH = "${config.xdg.configHome}/ccache.conf"; # INPUTRC = "${config.xdg.configHome}/inputrc"; # UPST Will use programs.readline, but doesn't allow path setting LESSHISTFILE = "${config.xdg.stateHome}/lesshst"; NODE_REPL_HISTORY = "${config.xdg.cacheHome}/node_repl_history"; PYTHONSTARTUP = "${config.xdg.configHome}/pythonstartup.py"; - RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed # TODO I think we're not using the urxvt daemon on purpose? # TODO this should be desktop only, as a few things are too. SCREENRC = "${config.xdg.configHome}/screenrc"; SQLITE_HISTFILE = "${config.xdg.stateHome}/sqlite_history"; YARN_DISABLE_SELF_UPDATE_CHECK = "true"; # This also disable the creation of a ~/.yarnrc file + } // lib.optionalAttrs config.frogeye.desktop.xorg { + # Favourite commands + VISUAL = "${pkgs.neovim}/bin/nvim"; + BROWSER = "${config.programs.qutebrowser.package}/bin/qutebrowser"; + + # Extra config + RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed # XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs - }; + } // direnv; # TODO Session variables only get reloaded on login I think. sessionPath = [ "$HOME/.local/bin" diff --git a/config/nix/hm/desktop.nix b/config/nix/hm/desktop.nix index 9c6bd90..6038026 100644 --- a/config/nix/hm/desktop.nix +++ b/config/nix/hm/desktop.nix @@ -1,43 +1,44 @@ { pkgs, config, lib, ... }: { - xsession = { - enable = true; - windowManager = { - i3 = { - enable = true; - config = - let - # lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme - # lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow - lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old - lockSvg = pkgs.writeText "lock.svg" ""; - lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out"; - locker = pkgs.writeShellScript "i3-locker" - '' - # Remove SSH and GPG keys from keystores - ${pkgs.openssh}/bin/ssh-add -D - echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent - ${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID" + config = lib.mkIf config.frogeye.desktop.xorg { + xsession = { + enable = true; + windowManager = { + i3 = { + enable = true; + config = + let + # lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme + # lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow + lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old + lockSvg = pkgs.writeText "lock.svg" ""; + lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out"; + locker = pkgs.writeShellScript "i3-locker" + '' + # Remove SSH and GPG keys from keystores + ${pkgs.openssh}/bin/ssh-add -D + echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent + ${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID" - ${pkgs.lightdm}/bin/dm-tool lock - # TODO Does that work for all DMs? - if [ $? -ne 0 ]; then - if [ -d ${config.xdg.cacheHome}/lockpatterns ] - then - pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1) - else - pattern=${lockPng} - fi - revert() { - ${pkgs.xorg.xset}/bin/xset dpms 0 0 0 - } - trap revert SIGHUP SIGINT SIGTERM - ${pkgs.xorg.xset}/bin/xset dpms 5 5 5 - ${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password - revert - fi - ''; - focus = "exec ${ pkgs.writeShellScript "i3-focus-window" + ${pkgs.lightdm}/bin/dm-tool lock + # TODO Does that work for all DMs? + if [ $? -ne 0 ]; then + if [ -d ${config.xdg.cacheHome}/lockpatterns ] + then + pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1) + else + pattern=${lockPng} + fi + revert() { + ${pkgs.xorg.xset}/bin/xset dpms 0 0 0 + } + trap revert SIGHUP SIGINT SIGTERM + ${pkgs.xorg.xset}/bin/xset dpms 5 5 5 + ${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password + revert + fi + ''; + focus = "exec ${ pkgs.writeShellScript "i3-focus-window" '' WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus` eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT @@ -46,589 +47,590 @@ ${pkgs.xdotool}/bin/xdotool mousemove -window $WINDOW $TX $TY '' }"; - mode_system = "[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction"; - mode_resize = "Resize"; - mode_pres_main = "Presentation (main display)"; - mode_pres_sec = "Presentation (secondary display)"; - mode_screen = "Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default"; - mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue"; - in - { - modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM - terminal = "alacritty"; - # bars = []; # FIXME lemonbar - colors = let ignore = "#ff00ff"; in - with config.lib.stylix.colors.withHashtag; lib.mkForce { - focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; }; - focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; }; - unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; }; - urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; }; - placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; }; - background = base07; - # I set the color of the active tab as the the background color of the terminal so they merge together. - }; - focus.followMouse = false; - keybindings = - let - mod = config.xsession.windowManager.i3.config.modifier; - rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi"; - pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS - scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ~/Screenshots/ && ${pkgs.optipng}/bin/optipng ~/Screenshots/$f'"; - # TODO nix path and create directory? - in - { - # Compatibility layer for people coming from other backgrounds - # "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM - "Mod1+F2" = "${rofi} -modi drun -show drun"; - # "Mod1+F4" = "kill"; # FIXME When no longer using a VM - # kill focused window - "${mod}+z" = "kill"; - button2 = "kill"; - # Rofi - "${mod}+c" = "exec --no-startup-id ${pkgs.rofi-pass}/bin/rofi-pass --last-used"; - # TODO Try autopass.cr - # 23.11 config.programs.rofi.pass.package - "${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji"; - "${mod}+plus" = "${rofi} -modi ssh -show ssh"; - "${mod}+ù" = "${rofi} -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t \"sudo -s -E\"'"; - # TODO In which keyboard layout? - "${mod}+Tab" = "${rofi} -modi window -show window"; - # start program launcher - "${mod}+d" = "${rofi} -modi run -show run"; - "${mod}+Shift+d" = "${rofi} -modi drun -show drun"; - # Start Applications - "${mod}+Return" = "exec ${ + mode_system = "[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction"; + mode_resize = "Resize"; + mode_pres_main = "Presentation (main display)"; + mode_pres_sec = "Presentation (secondary display)"; + mode_screen = "Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default"; + mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue"; + in + { + modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM + terminal = "alacritty"; + # bars = []; # FIXME lemonbar + colors = let ignore = "#ff00ff"; in + with config.lib.stylix.colors.withHashtag; lib.mkForce { + focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; }; + focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; }; + unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; }; + urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; }; + placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; }; + background = base07; + # I set the color of the active tab as the the background color of the terminal so they merge together. + }; + focus.followMouse = false; + keybindings = + let + mod = config.xsession.windowManager.i3.config.modifier; + rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi"; + pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS + scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ~/Screenshots/ && ${pkgs.optipng}/bin/optipng ~/Screenshots/$f'"; + # TODO nix path and create directory? + in + { + # Compatibility layer for people coming from other backgrounds + # "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM + "Mod1+F2" = "${rofi} -modi drun -show drun"; + # "Mod1+F4" = "kill"; # FIXME When no longer using a VM + # kill focused window + "${mod}+z" = "kill"; + button2 = "kill"; + # Rofi + "${mod}+c" = "exec --no-startup-id ${pkgs.rofi-pass}/bin/rofi-pass --last-used"; + # TODO Try autopass.cr + # 23.11 config.programs.rofi.pass.package + "${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji"; + "${mod}+plus" = "${rofi} -modi ssh -show ssh"; + "${mod}+ù" = "${rofi} -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t \"sudo -s -E\"'"; + # TODO In which keyboard layout? + "${mod}+Tab" = "${rofi} -modi window -show window"; + # start program launcher + "${mod}+d" = "${rofi} -modi run -show run"; + "${mod}+Shift+d" = "${rofi} -modi drun -show drun"; + # Start Applications + "${mod}+Return" = "exec ${ pkgs.writeShellScript "terminal" "${config.programs.alacritty.package}/bin/alacritty msg create-window || exec ${config.programs.alacritty.package}/bin/alacritty -e zsh" # -e zsh is for systems where I can't configure my user's shell # TODO Is a shell script even required? }"; - "${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt"; - "${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/thunar"; - "${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine"; - # TODO --backend not useful anymore - # Volume control - "XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; - "XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"; - "XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true"; - "${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset - "${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; - "${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; - # TODO Find pacmixer? - # Media control - "XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev"; - "XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle"; - "XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next"; - # Misc - "${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout" + "${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt"; + "${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/thunar"; + "${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine"; + # TODO --backend not useful anymore + # Volume control + "XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true"; + "${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset + "${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; + "${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; + # TODO Find pacmixer? + # Media control + "XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev"; + "XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle"; + "XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next"; + # Misc + "${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout" '' layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'` ${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout '' }"; - # Screenshots - "Print" = "exec ${scrot} --focused"; - "${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM - "Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select"; - # TODO Try using bindsym --release instead of sleep - # change focus - "${mod}+h" = "focus left; ${focus}"; - "${mod}+j" = "focus down; ${focus}"; - "${mod}+k" = "focus up; ${focus}"; - "${mod}+l" = "focus right; ${focus}"; - # move focused window - "${mod}+Shift+h" = "move left; ${focus}"; - "${mod}+Shift+j" = "move down; ${focus}"; - "${mod}+Shift+k" = "move up; ${focus}"; - "${mod}+Shift+l" = "move right; ${focus}"; - # workspace back and forth (with/without active container) - "${mod}+b" = "workspace back_and_forth; ${focus}"; - "${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}"; - # Change container layout - "${mod}+g" = "split h; ${focus}"; - "${mod}+v" = "split v; ${focus}"; - "${mod}+f" = "fullscreen toggle; ${focus}"; - "${mod}+s" = "layout stacking; ${focus}"; - "${mod}+w" = "layout tabbed; ${focus}"; - "${mod}+e" = "layout toggle split; ${focus}"; - "${mod}+Shift+space" = "floating toggle; ${focus}"; - # Focus container - "${mod}+space" = "focus mode_toggle; ${focus}"; - "${mod}+a" = "focus parent; ${focus}"; - "${mod}+q" = "focus child; ${focus}"; - # Switch to workspace - "${mod}+1" = "workspace 1; ${focus}"; - "${mod}+2" = "workspace 2; ${focus}"; - "${mod}+3" = "workspace 3; ${focus}"; - "${mod}+4" = "workspace 4; ${focus}"; - "${mod}+5" = "workspace 5; ${focus}"; - "${mod}+6" = "workspace 6; ${focus}"; - "${mod}+7" = "workspace 7; ${focus}"; - "${mod}+8" = "workspace 8; ${focus}"; - "${mod}+9" = "workspace 9; ${focus}"; - "${mod}+0" = "workspace 10; ${focus}"; - # TODO Prevent repetitions, see workspace assignation for example - #navigate workspaces next / previous - "${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}"; - "${mod}+Ctrl+l" = "workspace next_on_output; ${focus}"; - "${mod}+Ctrl+j" = "workspace prev; ${focus}"; - "${mod}+Ctrl+k" = "workspace next; ${focus}"; - # Move to workspace next / previous with focused container - "${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}"; - "${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}"; - "${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}"; - "${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}"; - # move focused container to workspace - "${mod}+ctrl+1" = "move container to workspace 1; ${focus}"; - "${mod}+ctrl+2" = "move container to workspace 2; ${focus}"; - "${mod}+ctrl+3" = "move container to workspace 3; ${focus}"; - "${mod}+ctrl+4" = "move container to workspace 4; ${focus}"; - "${mod}+ctrl+5" = "move container to workspace 5; ${focus}"; - "${mod}+ctrl+6" = "move container to workspace 6; ${focus}"; - "${mod}+ctrl+7" = "move container to workspace 7; ${focus}"; - "${mod}+ctrl+8" = "move container to workspace 8; ${focus}"; - "${mod}+ctrl+9" = "move container to workspace 9; ${focus}"; - "${mod}+ctrl+0" = "move container to workspace 10; ${focus}"; - # move to workspace with focused container - "${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}"; - "${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}"; - "${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}"; - "${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}"; - "${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}"; - "${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}"; - "${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}"; - "${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}"; - "${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}"; - "${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}"; - # move workspaces to screen (arrow keys) - "${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}"; - "${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}"; - "${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}"; - "${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}"; - # i3 control - "${mod}+Shift+c" = "reload"; - "${mod}+Shift+r" = "restart"; - "${mod}+Shift+e" = "exit"; - # Screen off commands - "${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\""; - # TODO --release? - "${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable"; - "${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable"; - # Modes - "${mod}+Escape" = "mode ${mode_system}"; - "${mod}+r" = "mode ${mode_resize}"; - "${mod}+Shift+p" = "mode ${mode_pres_main}"; - "${mod}+t" = "mode ${mode_screen}"; - "${mod}+y" = "mode ${mode_temp}"; - }; - modes = let return_bindings = { - "Return" = "mode default"; - "Escape" = "mode default"; - }; in - { - "${mode_system}" = { - "l" = "exec --no-startup-id exec ${locker}, mode default"; - "e" = "exit, mode default"; - "s" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default"; - "h" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default"; - "r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default"; - "p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default"; - } // return_bindings; - "${mode_resize}" = { - "h" = "resize shrink width 10 px or 10 ppt; ${focus}"; - "j" = "resize grow height 10 px or 10 ppt; ${focus}"; - "k" = "resize shrink height 10 px or 10 ppt; ${focus}"; - "l" = "resize grow width 10 px or 10 ppt; ${focus}"; - } // return_bindings; - "${mode_pres_main}" = { - "b" = "workspace 3, workspace 4, mode ${mode_pres_sec}"; - "q" = "mode default"; - "Return" = "mode default"; + # Screenshots + "Print" = "exec ${scrot} --focused"; + "${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM + "Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select"; + # TODO Try using bindsym --release instead of sleep + # change focus + "${mod}+h" = "focus left; ${focus}"; + "${mod}+j" = "focus down; ${focus}"; + "${mod}+k" = "focus up; ${focus}"; + "${mod}+l" = "focus right; ${focus}"; + # move focused window + "${mod}+Shift+h" = "move left; ${focus}"; + "${mod}+Shift+j" = "move down; ${focus}"; + "${mod}+Shift+k" = "move up; ${focus}"; + "${mod}+Shift+l" = "move right; ${focus}"; + # workspace back and forth (with/without active container) + "${mod}+b" = "workspace back_and_forth; ${focus}"; + "${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}"; + # Change container layout + "${mod}+g" = "split h; ${focus}"; + "${mod}+v" = "split v; ${focus}"; + "${mod}+f" = "fullscreen toggle; ${focus}"; + "${mod}+s" = "layout stacking; ${focus}"; + "${mod}+w" = "layout tabbed; ${focus}"; + "${mod}+e" = "layout toggle split; ${focus}"; + "${mod}+Shift+space" = "floating toggle; ${focus}"; + # Focus container + "${mod}+space" = "focus mode_toggle; ${focus}"; + "${mod}+a" = "focus parent; ${focus}"; + "${mod}+q" = "focus child; ${focus}"; + # Switch to workspace + "${mod}+1" = "workspace 1; ${focus}"; + "${mod}+2" = "workspace 2; ${focus}"; + "${mod}+3" = "workspace 3; ${focus}"; + "${mod}+4" = "workspace 4; ${focus}"; + "${mod}+5" = "workspace 5; ${focus}"; + "${mod}+6" = "workspace 6; ${focus}"; + "${mod}+7" = "workspace 7; ${focus}"; + "${mod}+8" = "workspace 8; ${focus}"; + "${mod}+9" = "workspace 9; ${focus}"; + "${mod}+0" = "workspace 10; ${focus}"; + # TODO Prevent repetitions, see workspace assignation for example + #navigate workspaces next / previous + "${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}"; + "${mod}+Ctrl+l" = "workspace next_on_output; ${focus}"; + "${mod}+Ctrl+j" = "workspace prev; ${focus}"; + "${mod}+Ctrl+k" = "workspace next; ${focus}"; + # Move to workspace next / previous with focused container + "${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}"; + "${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}"; + "${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}"; + "${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}"; + # move focused container to workspace + "${mod}+ctrl+1" = "move container to workspace 1; ${focus}"; + "${mod}+ctrl+2" = "move container to workspace 2; ${focus}"; + "${mod}+ctrl+3" = "move container to workspace 3; ${focus}"; + "${mod}+ctrl+4" = "move container to workspace 4; ${focus}"; + "${mod}+ctrl+5" = "move container to workspace 5; ${focus}"; + "${mod}+ctrl+6" = "move container to workspace 6; ${focus}"; + "${mod}+ctrl+7" = "move container to workspace 7; ${focus}"; + "${mod}+ctrl+8" = "move container to workspace 8; ${focus}"; + "${mod}+ctrl+9" = "move container to workspace 9; ${focus}"; + "${mod}+ctrl+0" = "move container to workspace 10; ${focus}"; + # move to workspace with focused container + "${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}"; + "${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}"; + "${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}"; + "${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}"; + "${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}"; + "${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}"; + "${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}"; + "${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}"; + "${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}"; + "${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}"; + # move workspaces to screen (arrow keys) + "${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}"; + "${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}"; + "${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}"; + "${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}"; + # i3 control + "${mod}+Shift+c" = "reload"; + "${mod}+Shift+r" = "restart"; + "${mod}+Shift+e" = "exit"; + # Screen off commands + "${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\""; + # TODO --release? + "${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable"; + "${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable"; + # Modes + "${mod}+Escape" = "mode ${mode_system}"; + "${mod}+r" = "mode ${mode_resize}"; + "${mod}+Shift+p" = "mode ${mode_pres_main}"; + "${mod}+t" = "mode ${mode_screen}"; + "${mod}+y" = "mode ${mode_temp}"; }; - "${mode_pres_sec}" = { - "b" = "workspace 1, workspace 2, mode ${mode_pres_main}"; - "q" = "mode default"; - "Return" = "mode default"; - }; - "${mode_screen}" = - let - builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ]; - autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu" - '' - shopt -s nullglob globstar - profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')" - profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")" - [[ -n "$profile" ]] || exit - ${pkgs.autorandr}/bin/autorandr ${option} "$profile" - ''; - in - { - "a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default"; - "l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default"; - "s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default"; - "r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default"; - "d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default"; + modes = let return_bindings = { + "Return" = "mode default"; + "Escape" = "mode default"; + }; in + { + "${mode_system}" = { + "l" = "exec --no-startup-id exec ${locker}, mode default"; + "e" = "exit, mode default"; + "s" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default"; + "h" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default"; + "r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default"; + "p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default"; } // return_bindings; - "${mode_temp}" = { - # "r" = "exec ${pkgs.sct}/bin/sct 1000"; - # "d" = "exec ${pkgs.sct}/bin/sct 2000"; - # "c" = "exec ${pkgs.sct}/bin/sct 4500"; - # "o" = "exec ${pkgs.sct}/bin/sct"; - # "a" = "exec ${pkgs.sct}/bin/sct 8000"; - # "b" = "exec ${pkgs.sct}/bin/sct 10000"; - # FIXME Not on aarch64 - } // return_bindings; + "${mode_resize}" = { + "h" = "resize shrink width 10 px or 10 ppt; ${focus}"; + "j" = "resize grow height 10 px or 10 ppt; ${focus}"; + "k" = "resize shrink height 10 px or 10 ppt; ${focus}"; + "l" = "resize grow width 10 px or 10 ppt; ${focus}"; + } // return_bindings; + "${mode_pres_main}" = { + "b" = "workspace 3, workspace 4, mode ${mode_pres_sec}"; + "q" = "mode default"; + "Return" = "mode default"; + }; + "${mode_pres_sec}" = { + "b" = "workspace 1, workspace 2, mode ${mode_pres_main}"; + "q" = "mode default"; + "Return" = "mode default"; + }; + "${mode_screen}" = + let + builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ]; + autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu" + '' + shopt -s nullglob globstar + profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')" + profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")" + [[ -n "$profile" ]] || exit + ${pkgs.autorandr}/bin/autorandr ${option} "$profile" + ''; + in + { + "a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default"; + "l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default"; + "s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default"; + "r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default"; + "d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default"; + } // return_bindings; + "${mode_temp}" = { + # "r" = "exec ${pkgs.sct}/bin/sct 1000"; + # "d" = "exec ${pkgs.sct}/bin/sct 2000"; + # "c" = "exec ${pkgs.sct}/bin/sct 4500"; + # "o" = "exec ${pkgs.sct}/bin/sct"; + # "a" = "exec ${pkgs.sct}/bin/sct 8000"; + # "b" = "exec ${pkgs.sct}/bin/sct 10000"; + # FIXME Not on aarch64 + } // return_bindings; + }; + window = { + hideEdgeBorders = "both"; + titlebar = false; # So that single-container screens are basically almost fullscreen + commands = [ + # Open specific applications in floating mode + { criteria = { class = "Firefox"; }; command = "layout tabbed"; } # Doesn't seem to work anymore + { criteria = { class = "qutebrowser"; }; command = "layout tabbed"; } + { criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; } + { criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; } + # switch to workspace with urgent window automatically + { criteria = { urgent = "latest"; }; command = "focus"; } + ]; }; - window = { - hideEdgeBorders = "both"; - titlebar = false; # So that single-container screens are basically almost fullscreen - commands = [ - # Open specific applications in floating mode - { criteria = { class = "Firefox"; }; command = "layout tabbed"; } # Doesn't seem to work anymore - { criteria = { class = "qutebrowser"; }; command = "layout tabbed"; } - { criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; } - { criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; } - # switch to workspace with urgent window automatically - { criteria = { urgent = "latest"; }; command = "focus"; } - ]; - }; - floating = { - criteria = [ - { title = "pacmixer"; } - { window_role = "pop-up"; } - { window_role = "task_dialog"; } - ]; - }; - startup = [ - # Lock screen after 10 minutes - { notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; } - { - notification = false; - command = "${pkgs.writeShellApplication { + floating = { + criteria = [ + { title = "pacmixer"; } + { window_role = "pop-up"; } + { window_role = "task_dialog"; } + ]; + }; + startup = [ + # Lock screen after 10 minutes + { notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; } + { + notification = false; + command = "${pkgs.writeShellApplication { name = "batteryNotify"; runtimeInputs = with pkgs; [coreutils libnotify]; text = builtins.readFile ./batteryNotify.sh; # TODO Use batsignal instead? # TODO Only on computers with battery }}/bin/batteryNotify"; - } - # TODO There's a services.screen-locker.xautolock but not sure it can match the above command - ]; - workspaceLayout = "tabbed"; - focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus} - workspaceOutputAssign = - let - x11_screens = [ "HDMI-1-0" "eDP1" ]; # FIXME Per computer thing - workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10); - forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1)); - in - forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; }); + } + # TODO There's a services.screen-locker.xautolock but not sure it can match the above command + ]; + workspaceLayout = "tabbed"; + focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus} + workspaceOutputAssign = + let + x11_screens = [ "HDMI-1-0" "eDP1" ]; # FIXME Per computer thing + workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10); + forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1)); + in + forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; }); + }; + }; + }; + numlock.enable = true; # FIXME Only on computers with a separate one + }; + + programs = { + # Browser + qutebrowser = { + enable = true; + keyBindings = { + normal = { + # Match tab behaviour to i3. Not that I use them. + "H" = "tab-prev"; + "J" = "back"; + "K" = "forward"; + "L" = "tab-next"; + # "T" = null; + "af" = "spawn --userscript freshrss"; # TODO Broken? + "as" = "spawn --userscript shaarli"; # TODO I don't use shaarli anymore + # "d" = null; + "u" = "undo --window"; + # TODO Unbind d and T (?) }; + }; + loadAutoconfig = true; # FIXME Salvage stuff from autoconfig.yml + searchEngines = rec { + DEFAULT = ecosia; + ampwhat = "http://www.amp-what.com/unicode/search/{}"; + aw = ampwhat; + ddg = duckduckgo; + duckduckgo = "https://duckduckgo.com/?q={}&ia=web"; + ecosia = "https://www.ecosia.org/search?q={}"; + github = "https://github.com/search?q={}"; + google = "https://www.google.fr/search?q={}"; + g = google; + npm = "https://www.npmjs.com/search?q={}"; + q = qwant; + qwant = "https://www.qwant.com/?t=web&q={}"; + wolfram = "https://www.wolframalpha.com/input/?i={}"; + youtube = "https://www.youtube.com/results?search_query={}"; + yt = youtube; + }; + settings = { + downloads.location.prompt = false; + tabs = { + show = "never"; + tabs_are_windows = true; + }; + url = { + open_base_url = true; + start_pages = "https://geoffrey.frogeye.fr/blank.html"; + }; + content = { + # I had this setting below, not sure if it did something special + # config.set("content.cookies.accept", "no-3rdparty", "chrome://*/*") + cookies.accept = "no-3rdparty"; + prefers_reduced_motion = true; + }; + }; }; - }; - numlock.enable = true; # FIXME Only on computers with a separate one - }; - programs = { - # Browser - qutebrowser = { - enable = true; - keyBindings = { - normal = { - # Match tab behaviour to i3. Not that I use them. - "H" = "tab-prev"; - "J" = "back"; - "K" = "forward"; - "L" = "tab-next"; - # "T" = null; - "af" = "spawn --userscript freshrss"; # TODO Broken? - "as" = "spawn --userscript shaarli"; # TODO I don't use shaarli anymore - # "d" = null; - "u" = "undo --window"; - # TODO Unbind d and T (?) - }; - }; - loadAutoconfig = true; # FIXME Salvage stuff from autoconfig.yml - searchEngines = rec { - DEFAULT = ecosia; - ampwhat = "http://www.amp-what.com/unicode/search/{}"; - aw = ampwhat; - ddg = duckduckgo; - duckduckgo = "https://duckduckgo.com/?q={}&ia=web"; - ecosia = "https://www.ecosia.org/search?q={}"; - github = "https://github.com/search?q={}"; - google = "https://www.google.fr/search?q={}"; - g = google; - npm = "https://www.npmjs.com/search?q={}"; - q = qwant; - qwant = "https://www.qwant.com/?t=web&q={}"; - wolfram = "https://www.wolframalpha.com/input/?i={}"; - youtube = "https://www.youtube.com/results?search_query={}"; - yt = youtube; - }; - settings = { - downloads.location.prompt = false; - tabs = { - show = "never"; - tabs_are_windows = true; - }; - url = { - open_base_url = true; - start_pages = "https://geoffrey.frogeye.fr/blank.html"; - }; - content = { - # I had this setting below, not sure if it did something special - # config.set("content.cookies.accept", "no-3rdparty", "chrome://*/*") - cookies.accept = "no-3rdparty"; - prefers_reduced_motion = true; - }; - }; - }; - - # Terminal - alacritty = { - # FIXME Emojis - enable = true; - settings = { - bell = { - animation = "EaseOutExpo"; - color = "#000000"; - command = { program = "${pkgs.sox}/bin/play"; args = [ "-n" "synth" "sine" "C5" "sine" "E4" "remix" "1-2" "fade" "0.1" "0.2" "0.1" ]; }; - duration = 100; - }; - cursor = { vi_mode_style = "Underline"; }; - hints = { - enabled = [ - { - binding = { mods = "Control|Alt"; key = "F"; }; - command = "${pkgs.xdg-utils}/bin/xdg-open"; - mouse = { enabled = true; mods = "Control"; }; - post_processing = true; - regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\\\s{-}\\\\^⟨⟩`]+"; - } + # Terminal + alacritty = { + # FIXME Emojis + enable = true; + settings = { + bell = { + animation = "EaseOutExpo"; + color = "#000000"; + command = { program = "${pkgs.sox}/bin/play"; args = [ "-n" "synth" "sine" "C5" "sine" "E4" "remix" "1-2" "fade" "0.1" "0.2" "0.1" ]; }; + duration = 100; + }; + cursor = { vi_mode_style = "Underline"; }; + hints = { + enabled = [ + { + binding = { mods = "Control|Alt"; key = "F"; }; + command = "${pkgs.xdg-utils}/bin/xdg-open"; + mouse = { enabled = true; mods = "Control"; }; + post_processing = true; + regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\\\s{-}\\\\^⟨⟩`]+"; + } + ]; + }; + key_bindings = [ + { mode = "~Search"; mods = "Alt|Control"; key = "Space"; action = "ToggleViMode"; } + { mode = "Vi|~Search"; mods = "Control"; key = "K"; action = "ScrollHalfPageUp"; } + { mode = "Vi|~Search"; mods = "Control"; key = "J"; action = "ScrollHalfPageDown"; } + { mode = "~Vi"; mods = "Control|Alt"; key = "V"; action = "Paste"; } + { mods = "Control|Alt"; key = "C"; action = "Copy"; } + { mode = "~Search"; mods = "Control|Alt"; key = "F"; action = "SearchForward"; } + { mode = "~Search"; mods = "Control|Alt"; key = "B"; action = "SearchBackward"; } + { mode = "Vi|~Search"; mods = "Control|Alt"; key = "C"; action = "ClearSelection"; } ]; + window = { + dynamic_padding = false; + dynamic_title = true; + }; }; - key_bindings = [ - { mode = "~Search"; mods = "Alt|Control"; key = "Space"; action = "ToggleViMode"; } - { mode = "Vi|~Search"; mods = "Control"; key = "K"; action = "ScrollHalfPageUp"; } - { mode = "Vi|~Search"; mods = "Control"; key = "J"; action = "ScrollHalfPageDown"; } - { mode = "~Vi"; mods = "Control|Alt"; key = "V"; action = "Paste"; } - { mods = "Control|Alt"; key = "C"; action = "Copy"; } - { mode = "~Search"; mods = "Control|Alt"; key = "F"; action = "SearchForward"; } - { mode = "~Search"; mods = "Control|Alt"; key = "B"; action = "SearchBackward"; } - { mode = "Vi|~Search"; mods = "Control|Alt"; key = "C"; action = "ClearSelection"; } - ]; - window = { - dynamic_padding = false; - dynamic_title = true; + }; + # Backup terminal + urxvt = { + enable = true; + package = pkgs.rxvt-unicode-emoji; + scroll = { + bar.enable = false; + }; + iso14755 = false; # Disable Ctrl+Shift default bindings + keybindings = { + "Shift-Control-C" = "eval:selection_to_clipboard"; + "Shift-Control-V" = "eval:paste_clipboard"; + # TODO Not sure resizing works, Nix doesn't have the package (urxvt-resize-font-git on Arch) + "Control-KP_Subtract" = "resize-font:smaller"; + "Control-KP_Add" = "resize-font:bigger"; + }; + extraConfig = { + "letterSpace" = 0; + "perl-ext-common" = "resize-font,bell-command,readline,selection"; + "bell-command" = "${pkgs.sox}/bin/play -n synth sine C5 sine E4 remix 1-2 fade 0.1 0.2 0.1 &> /dev/null"; + }; + }; + rofi = { + enable = true; + pass.enable = true; + extraConfig = { + lazy-grab = false; + matching = "regex"; + }; + }; + autorandr.enable = true; + mpv = { + enable = true; + config = { + audio-display = false; + save-position-on-quit = true; + osc = false; # # Required by thumbnail script + }; + scripts = with pkgs.mpvScripts; [ thumbnail ]; + scriptOpts = { + mpv_thumbnail_script = { + cache_directory = "/tmp/mpv_thumbs_${config.home.username}"; + }; }; }; }; - # Backup terminal - urxvt = { - enable = true; - package = pkgs.rxvt-unicode-emoji; - scroll = { - bar.enable = false; - }; - iso14755 = false; # Disable Ctrl+Shift default bindings - keybindings = { - "Shift-Control-C" = "eval:selection_to_clipboard"; - "Shift-Control-V" = "eval:paste_clipboard"; - # TODO Not sure resizing works, Nix doesn't have the package (urxvt-resize-font-git on Arch) - "Control-KP_Subtract" = "resize-font:smaller"; - "Control-KP_Add" = "resize-font:bigger"; - }; - extraConfig = { - "letterSpace" = 0; - "perl-ext-common" = "resize-font,bell-command,readline,selection"; - "bell-command" = "${pkgs.sox}/bin/play -n synth sine C5 sine E4 remix 1-2 fade 0.1 0.2 0.1 &> /dev/null"; - }; - }; - rofi = { - enable = true; - pass.enable = true; - extraConfig = { - lazy-grab = false; - matching = "regex"; - }; - }; - autorandr.enable = true; - mpv = { - enable = true; - config = { - audio-display = false; - save-position-on-quit = true; - osc = false; # # Required by thumbnail script - }; - scripts = with pkgs.mpvScripts; [ thumbnail ]; - scriptOpts = { - mpv_thumbnail_script = { - cache_directory = "/tmp/mpv_thumbs_${config.home.username}"; - }; - }; - }; - }; - xdg = { - mimeApps = { - enable = true; - associations.added = { - "text/html" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop"; + xdg = { + mimeApps = { + enable = true; + associations.added = { + "text/html" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop"; + }; }; - }; - userDirs = { - enable = true; # TODO Which ones do we want? - createDirectories = true; - # French, because then it there's a different initial for each, making navigation easier - desktop = null; - download = "${config.home.homeDirectory}/Téléchargements"; - music = "${config.home.homeDirectory}/Musiques"; - pictures = "${config.home.homeDirectory}/Images"; - publicShare = null; - templates = null; - videos = "${config.home.homeDirectory}/Vidéos"; - extraConfig = { - XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Screenshots"; + userDirs = { + enable = true; # TODO Which ones do we want? + createDirectories = true; + # French, because then it there's a different initial for each, making navigation easier + desktop = null; + download = "${config.home.homeDirectory}/Téléchargements"; + music = "${config.home.homeDirectory}/Musiques"; + pictures = "${config.home.homeDirectory}/Images"; + publicShare = null; + templates = null; + videos = "${config.home.homeDirectory}/Vidéos"; + extraConfig = { + XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Screenshots"; + }; }; - }; - configFile = { - "pulse/client.conf" = { - text = ''cookie-file = .config/pulse/pulse-cookie''; - }; - "xinitrc" = - let - nixgl = import - (builtins.fetchGit { - url = "https://github.com/nix-community/nixGL"; - rev = "489d6b095ab9d289fe11af0219a9ff00fe87c7c5"; - }) - { }; - nixGLIntelPrefix = "${nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${nixgl.nixGLIntel}/bin/nixGLIntel "; - wmPrefix = "${lib.optionalString config.frogeye.desktop.nixGLIntel nixGLIntelPrefix}"; - in - { - source = pkgs.writeShellScript "xinitrc" '' - ${pkgs.xorg.xrdb}/bin/xrdb ${config.xresources.path} - ${wmPrefix}${config.xsession.windowManager.command} + configFile = { + "pulse/client.conf" = { + text = ''cookie-file = .config/pulse/pulse-cookie''; + }; + "xinitrc" = + let + nixgl = import + (builtins.fetchGit { + url = "https://github.com/nix-community/nixGL"; + rev = "489d6b095ab9d289fe11af0219a9ff00fe87c7c5"; + }) + { }; + nixGLIntelPrefix = "${nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${nixgl.nixGLIntel}/bin/nixGLIntel "; + wmPrefix = "${lib.optionalString config.frogeye.desktop.nixGLIntel nixGLIntelPrefix}"; + in + { + source = pkgs.writeShellScript "xinitrc" '' + ${pkgs.xorg.xrdb}/bin/xrdb ${config.xresources.path} + ${wmPrefix}${config.xsession.windowManager.command} + ''; + }; + "rofimoji.rc" = { + text = '' + skin-tone = neutral + files = [emojis, math] + action = clipboard ''; }; - "rofimoji.rc" = { - text = '' - skin-tone = neutral - files = [emojis, math] - action = clipboard + }; + }; + services = { + unclutter.enable = true; + dunst = + { + enable = true; + settings = + # TODO Change dmenu for rofi, so we can use context + with config.lib.stylix.colors.withHashtag; { + global = { + separator_color = lib.mkForce base05; + idle_threshold = 120; + markup = "full"; + max_icon_size = 48; + # TODO Those shortcuts don't seem to work, maybe try: + # > define shortcuts inside your window manager and bind them to dunstctl(1) commands + close_all = "ctrl+mod4+n"; + close = "mod4+n"; + context = "mod1+mod4+n"; + history = "shift+mod4+n"; + }; + + urgency_low = { + background = lib.mkForce base01; + foreground = lib.mkForce base03; + frame_color = lib.mkForce base05; + }; + urgency_normal = { + background = lib.mkForce base02; + foreground = lib.mkForce base05; + frame_color = lib.mkForce base05; + }; + urgency_critical = { + background = lib.mkForce base08; + foreground = lib.mkForce base06; + frame_color = lib.mkForce base05; + }; + }; + }; + mpd = { + enable = true; + network = { + listenAddress = "0.0.0.0"; # So it can be controlled from home + # TODO ... and whoever is the Wi-Fi network I'm using, which, not great + port = 8601; # FIXME Chose a different one for testing, should revert + startWhenNeeded = true; + }; + extraConfig = '' + restore_paused "yes" ''; }; + autorandr.enable = true; }; - }; - services = { - unclutter.enable = true; - dunst = - { - enable = true; - settings = - # TODO Change dmenu for rofi, so we can use context - with config.lib.stylix.colors.withHashtag; { - global = { - separator_color = lib.mkForce base05; - idle_threshold = 120; - markup = "full"; - max_icon_size = 48; - # TODO Those shortcuts don't seem to work, maybe try: - # > define shortcuts inside your window manager and bind them to dunstctl(1) commands - close_all = "ctrl+mod4+n"; - close = "mod4+n"; - context = "mod1+mod4+n"; - history = "shift+mod4+n"; - }; - urgency_low = { - background = lib.mkForce base01; - foreground = lib.mkForce base03; - frame_color = lib.mkForce base05; - }; - urgency_normal = { - background = lib.mkForce base02; - foreground = lib.mkForce base05; - frame_color = lib.mkForce base05; - }; - urgency_critical = { - background = lib.mkForce base08; - foreground = lib.mkForce base06; - frame_color = lib.mkForce base05; - }; - }; + home = { + packages = with pkgs; [ + # remote + tigervnc + + # music + mpc-cli + ashuffle + vimpc + + # multimedia common + gimp + inkscape + libreoffice + + # data management + freefilesync + + # browsers + firefox + + # fonts + dejavu_fonts + twemoji-color-font + gnome.gedit + feh + zathura + zbar + zathura + meld + python3Packages.magic + yubikey-touch-detector + + # x11-exclusive + numlockx + simplescreenrecorder + trayer + xclip + keynav + xorg.xinit + xorg.xbacklight + # TODO Make this clean. Service? + (callPackage (import ./frobar) { }) # FIXME Call it where needed + + + # organisation + pass + thunderbird + ]; + sessionVariables = { + MPD_PORT = "${toString config.services.mpd.network.port}"; }; - mpd = { - enable = true; - network = { - listenAddress = "0.0.0.0"; # So it can be controlled from home - # TODO ... and whoever is the Wi-Fi network I'm using, which, not great - port = 8601; # FIXME Chose a different one for testing, should revert - startWhenNeeded = true; - }; - extraConfig = '' - restore_paused "yes" - ''; - }; - autorandr.enable = true; - }; - - home = { - packages = with pkgs; [ - # remote - tigervnc - - # music - mpc-cli - ashuffle - vimpc - - # multimedia common - gimp - inkscape - libreoffice - - # data management - freefilesync - - # browsers - firefox - - # fonts - dejavu_fonts - twemoji-color-font - gnome.gedit - feh - zathura - zbar - zathura - meld - python3Packages.magic - yubikey-touch-detector - - # x11-exclusive - numlockx - simplescreenrecorder - trayer - xclip - keynav - xorg.xinit - xorg.xbacklight - # TODO Make this clean. Service? - (callPackage (import ./frobar) { }) # FIXME Call it where needed - - - # organisation - pass - thunderbird - ]; - sessionVariables = { - MPD_PORT = "${toString config.services.mpd.network.port}"; }; }; } diff --git a/config/nix/hm/dev.nix b/config/nix/hm/dev.nix index 2f1f4db..a7c5287 100644 --- a/config/nix/hm/dev.nix +++ b/config/nix/hm/dev.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ pkgs, config, ... }: { # TODO Separate in diffrent packages once the structure is finalized... # or connvert into per-directory requirements home.packages = with pkgs; [ @@ -19,17 +19,14 @@ yq universal-ctags highlight - zeal-qt6 # Offline documentation # Docker docker docker-compose # FPGA - yosys verilog # ghdl # TODO Not on aarch64 - gtkwave # TODO Display server only # Network socat @@ -37,13 +34,22 @@ whois nmap tcpdump - wireshark-qt # TODO Display server only # nix nix # Python python3Packages.ipython + ] ++ lib.optionals config.frogeye.desktop.xorg [ + # Common + zeal-qt6 # Offline documentation + + # FPGA + yosys + gtkwave + + # Network + wireshark-qt ]; } diff --git a/config/nix/hm/extra.nix b/config/nix/hm/extra.nix index b8b6ee0..efd2b78 100644 --- a/config/nix/hm/extra.nix +++ b/config/nix/hm/extra.nix @@ -1,27 +1,14 @@ { pkgs, lib, config, ... }: { - home.packages = with pkgs; lib.mkIf config.frogeye.extra [ + home.packages = with pkgs; lib.mkIf config.frogeye.extra ([ # android tools android-tools - # multimedia editors - gimp - inkscape - darktable - blender - puddletag - musescore - audacity - # downloading yt-dlp megatools # transmission TODO Collision if both transmissions are active? - transmission-qt - # wine - wine - # TODO wine-gecko wine-mono lib32-libpulse (?) # documents pandoc @@ -34,11 +21,30 @@ hunspellDicts.nl_NL # TODO libreoffice-extension-languagetool or libreoffice-extension-grammalecte-fr + ] ++ lib.optionals config.frogeye.desktop.xorg [ + + # multimedia editors + gimp + inkscape + darktable + blender + puddletag + musescore + audacity + + # downloading + transmission-qt + + # wine + wine + # TODO wine-gecko wine-mono lib32-libpulse (?) + # gaming steam yuzu-mainline minecraft # TODO factorio - ]; + + ]); } diff --git a/config/nix/options.nix b/config/nix/options.nix index 0b2bf4e..5162440 100644 --- a/config/nix/options.nix +++ b/config/nix/options.nix @@ -2,6 +2,9 @@ { options.frogeye = { extra = lib.mkEnableOption "Big software"; - desktop.nixGLIntel = lib.mkEnableOption "Enable nixGLIntel/nixVulkanIntel for windows manager"; + desktop = { + xorg = lib.mkEnableOption "Enable X11 support"; + nixGLIntel = lib.mkEnableOption "Enable nixGLIntel/nixVulkanIntel for windows manager"; + }; }; } diff --git a/config/nix/os/desktop.nix b/config/nix/os/desktop.nix index 51b95dd..c6a2d16 100644 --- a/config/nix/os/desktop.nix +++ b/config/nix/os/desktop.nix @@ -1,17 +1,18 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: { - # Enable the X11 windowing system - services.xserver.enable = true; + config = lib.mkIf config.frogeye.desktop.xorg { + # Enable the X11 windowing system - services.xserver = { - windowManager.i3.enable = true; - displayManager.defaultSession = "none+i3"; + services.xserver = { + enable = true; + windowManager.i3.enable = true; + displayManager.defaultSession = "none+i3"; - # Keyboard layout - extraLayouts.qwerty-fr = { - description = "QWERTY-fr"; - languages = [ "fr" ]; - symbolsFile = "${pkgs.stdenv.mkDerivation { + # Keyboard layout + extraLayouts.qwerty-fr = { + description = "QWERTY-fr"; + languages = [ "fr" ]; + symbolsFile = "${pkgs.stdenv.mkDerivation { name = "qwerty-fr-keypad"; src = builtins.fetchGit { url = "https://github.com/qwerty-fr/qwerty-fr.git"; @@ -26,11 +27,12 @@ runHook postInstall ''; }}/linux/us_qwerty-fr"; + }; + layout = "qwerty-fr"; }; - layout = "qwerty-fr"; - }; - # Enable sound - sound.enable = true; - hardware.pulseaudio.enable = true; + # Enable sound + sound.enable = true; + hardware.pulseaudio.enable = true; + }; } diff --git a/config/nix/pindakaas.nix b/config/nix/pindakaas.nix index a7f49c9..576b163 100644 --- a/config/nix/pindakaas.nix +++ b/config/nix/pindakaas.nix @@ -5,8 +5,10 @@ ./os/loader.nix ]; - networking.hostName = "pindakaas"; # nixos-hardware use latest kernel by default. This obviously runs quickly out of sync with zfs packages. # zfs packages are included despite me asking anything zfs, probably they're in the image for installation purposes? boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + + networking.hostName = "pindakaas"; + frogeye.desktop.xorg = true; }