From e32cb845ace78b3e1e6d6cc45c29886c0be7140d Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 13 Dec 2023 11:41:26 +0100 Subject: [PATCH] introduce home-manager gui.enable option --- flake.nix | 22 + nixos/homes/common/default.nix | 4 + nixos/homes/palo/default.nix | 58 +-- nixos/homes/palo/doom-emacs.nix | 53 ++- nixos/homes/palo/dunst.nix | 169 -------- nixos/homes/palo/i3.nix | 738 +++++++++++++++++++++----------- 6 files changed, 538 insertions(+), 506 deletions(-) create mode 100644 nixos/homes/common/default.nix delete mode 100644 nixos/homes/palo/dunst.nix diff --git a/flake.nix b/flake.nix index 3a8ebb9..36bb283 100644 --- a/flake.nix +++ b/flake.nix @@ -233,6 +233,25 @@ stylix.nixosModules.stylix ]; stylix.image = ./nixos/assets/wallpaper.png; + stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-light-medium.yaml"; + stylix.fonts = { + serif = { + package = pkgs.ubuntu_font_family; + name = "Ubuntu"; + }; + sansSerif = { + package = pkgs.ubuntu_font_family; + name = "Ubuntu"; + }; + monospace = { + package = pkgs.jetbrains-mono; + name = "JetBrains Mono"; + }; + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + }; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; @@ -309,7 +328,9 @@ retiolum.nixosModules.retiolum private_assets.nixosModules.jobrad homeManagerModules + # { home-manager.users.root = import ./nixos/homes/root; } { home-manager.users.mainUser = import ./nixos/homes/palo; } + { home-manager.users.mainUser.gui.enable = true; } ]; }; chungus = nixosConfigurationSetup { @@ -317,6 +338,7 @@ modules = [ homeManagerModules retiolum.nixosModules.retiolum + { home-manager.users.mainUser = import ./nixos/homes/palo; } ]; }; robi = nixosConfigurationSetup { diff --git a/nixos/homes/common/default.nix b/nixos/homes/common/default.nix new file mode 100644 index 0000000..1d97c65 --- /dev/null +++ b/nixos/homes/common/default.nix @@ -0,0 +1,4 @@ +{ lib, ... }: +{ + options.gui.enable = lib.mkEnableOption "should GUI packages be anabled?"; +} diff --git a/nixos/homes/palo/default.nix b/nixos/homes/palo/default.nix index 3ec1398..db95eb5 100644 --- a/nixos/homes/palo/default.nix +++ b/nixos/homes/palo/default.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { imports = [ + ../common ./doom-emacs.nix - ./dunst.nix ./i3.nix ./ssh.nix ./stylix.nix @@ -10,7 +10,6 @@ home.stateVersion = "22.11"; - programs.git = { enable = true; userName = "Ingolf Wagner"; @@ -48,52 +47,6 @@ settings.tree_view = true; }; - xdg.configFile."albert/albert.conf".text = '' - [General] - hotkey=Meta+Space - showTray=false - telemetry=false - terminal=urxvt -e - - [org.albert.extension.applications] - enabled=true - fuzzy=true - use_generic_name=true - use_keywords=true - - [org.albert.extension.calculator] - enabled=true - - [org.albert.extension.hashgenerator] - enabled=true - - [org.albert.frontend.widgetboxmodel] - alwaysOnTop=true - clearOnHide=false - displayIcons=true - displayScrollbar=false - displayShadow=false - hideOnClose=false - hideOnFocusLoss=true - itemCount=5 - showCentered=true - theme=SolarizedBrightViolet - ''; - - xdg.configFile."Code/User/settings.json".text = builtins.toJSON { - "keyboard.dispatch" = "keyCode"; - "explorer.confirmDragAndDrop" = false; - "editor.tabSize" = 2; - "window.zoomLevel" = -1; - "git.enableSmartCommit" = true; - "files.autoSave" = "onFocusChange"; - "terminal.integrated.setLocaleVariables" = true; - "terminal.external.linuxExec" = "xterm"; - "explorer.confirmDelete" = false; - "todo-tree.tags" = [ "todo" "TODO" "fixme" "FIXME" ]; - "workbench.colorTheme" = "Solarized Light"; - }; - xdg.configFile."mimeapps.list".text = '' [Default Applications] text/html=browser-select.desktop @@ -107,7 +60,6 @@ image/jpeg=sxiv.desktop ''; - xdg.configFile."khal/config".text = '' [calendars] @@ -146,12 +98,4 @@ fileext = ".ics" ''; - home.packages = - let - fixXhost = pkgs.writers.writeBashBin "fix-xhost" '' - ${pkgs.xorg.xhost}/bin/xhost + &> /dev/null - ''; - in - [ fixXhost ]; - } diff --git a/nixos/homes/palo/doom-emacs.nix b/nixos/homes/palo/doom-emacs.nix index 11babe0..be93d78 100644 --- a/nixos/homes/palo/doom-emacs.nix +++ b/nixos/homes/palo/doom-emacs.nix @@ -1,28 +1,35 @@ { config, pkgs, lib, ... }: with lib; { - - programs.doom-emacs = { - enable = lib.mkDefault true; - doomPrivateDir = ./doom.d; - extraConfig = '' - ;; "monospace" means use the system default. However, the default is usually two - ;; points larger than I'd like, so I specify size 12 here. - (setq doom-font - (font-spec :family "Jetbrains Mono" :size ${toString 12} :weight 'light)) - ;(setq doom-font - ; (font-spec :family "Terminus" :size ${toString 10} :weight 'light)) - ''; - - #emacsPackagesOverlay = self: super: { - # # fixes https://github.com/vlaci/nix-doom-emacs/issues/394 - # gitignore-mode = pkgs.emacsPackages.git-modes; - # gitconfig-mode = pkgs.emacsPackages.git-modes; - #}; - }; - - home.packages = [ - pkgs.ripgrep + config = mkMerge [ + { + home.packages = [ pkgs.ripgrep ]; + } + (mkIf config.gui.enable { + programs.doom-emacs = { + enable = lib.mkDefault true; + doomPrivateDir = ./doom.d; + extraConfig = '' + ;; "monospace" means use the system default. However, the default is usually two + ;; points larger than I'd like, so I specify size 12 here. + (setq doom-font + (font-spec :family "Jetbrains Mono" :size ${toString 12} :weight 'light)) + ;;(setq doom-font + ;; (font-spec :family "Terminus" :size ${toString 12} :weight 'light)) + ''; + #emacsPackagesOverlay = self: super: { + # # fixes https://github.com/vlaci/nix-doom-emacs/issues/394 + # gitignore-mode = pkgs.emacsPackages.git-modes; + # gitconfig-mode = pkgs.emacsPackages.git-modes; + #}; + }; + }) + (mkIf (!config.gui.enable) { + programs.doom-emacs = { + enable = lib.mkDefault true; + doomPrivateDir = ./doom.d; + package = pkgs.emacs-nox; + }; + }) ]; - } diff --git a/nixos/homes/palo/dunst.nix b/nixos/homes/palo/dunst.nix deleted file mode 100644 index b7dbe46..0000000 --- a/nixos/homes/palo/dunst.nix +++ /dev/null @@ -1,169 +0,0 @@ -{ pkgs, config, lib, ... }: -{ - - services.dunst = { - enable = true; - settings = { - global = { - # Allow a small subset of html markup: - # bold - # italic - # strikethrough - # underline - # - # For a complete reference see - # . - # If markup is not allowed, those tags will be stripped out of the - # message. - markup = "yes"; - plain_text = "no"; - - # The format of the message. Possible variables are: - # %a appname - # %s summary - # %b body - # %i iconname (including its path) - # %I iconname (without its path) - # %p progress value if set ([ 0%] to [100%]) or nothing - # Markup is allowed - format = '' - %a - %s - %b''; - - # Sort messages by urgency. - sort = "yes"; - - # Show how many messages are currently hidden (because of geometry). - indicate_hidden = "yes"; - - # Alignment of message text. - # Possible values are "left", "center" and "right". - alignment = "center"; - - # The frequency with wich text that is longer than the notification - # window allows bounces back and forth. - # This option conflicts with "word_wrap". - # Set to 0 to disable. - bounce_freq = 0; - - # Show age of message if message is older than show_age_threshold - # seconds. - # Set to -1 to disable. - show_age_threshold = 1; - - # Split notifications into multiple lines if they don't fit into - # geometry. - word_wrap = "yes"; - - # Ignore newlines '\n' in notifications. - ignore_newline = "no"; - - # Hide duplicate's count and stack them - stack_duplicates = "yes"; - hide_duplicates_count = "no"; - - # The geometry of the window: - # [{width}]x{height}[+/-{x}+/-{y}] - # The geometry of the message window. - # The height is measured in number of notifications everything else - # in pixels. If the width is omitted but the height is given - # ("-geometry x2"), the message window expands over the whole screen - # (dmenu-like). If width is 0, the window expands to the longest - # message displayed. A positive x is measured from the left, a - # negative from the right side of the screen. Y is measured from - # the top and down respectevly. - # The width can be negative. In this case the actual width is the - # screen width minus the width defined in within the geometry option. - geometry = "500x10-0+0"; - - # Shrink window if it's smaller than the width. Will be ignored if - # width is 0. - shrink = "no"; - - # Don't remove messages, if the user is idle (no mouse or keyboard input) - # for longer than idle_threshold seconds. - # Set to 0 to disable. - idle_threshold = 0; - - # The transparency of the window. Range: [0; 100]. - # This option will only work if a compositing windowmanager is - # present (e.g. xcompmgr, compiz, etc.). - # transparency = 5 - - # Which monitor should the notifications be displayed on. - #monitor = keyboard - - # Display notification on focused monitor. Possible modes are: - # mouse: follow mouse pointer - # keyboard: follow window with keyboard focus - # none: don't follow anything - # - # "keyboard" needs a windowmanager that exports the - # _NET_ACTIVE_WINDOW property. - # This should be the case for almost all modern windowmanagers. - # - # If this option is set to mouse or keyboard, the monitor option - # will be ignored. - follow = "none"; - - # Should a notification popped up from history be sticky or timeout - # as if it would normally do. - sticky_history = "yes"; - - # Maximum amount of notifications kept in history - history_length = 15; - - # Display indicators for URLs (U) and actions (A). - show_indicators = "no"; - - # The height of a single line. If the height is smaller than the - # font height, it will get raised to the font height. - # This adds empty space above and under the text. - line_height = 3; - - # Draw a line of "separatpr_height" pixel height between two - # notifications. - # Set to 0 to disable. - separator_height = 1; - - # Padding between text and separator. - padding = 1; - - # Horizontal padding. - horizontal_padding = 1; - - # Print a notification on startup. - # This is mainly for error detection, since dbus (re-)starts dunst - # automatically after a crash. - startup_notification = true; - - # Align icons left/right/off - icon_position = "off"; - max_icon_size = 80; - frame_width = 2; - }; - shortcuts = { - - # Shortcuts are specified as [modifier+][modifier+]...key - # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", - # "mod3" and "mod4" (windows-key). - # Xev might be helpful to find names for keys. - - # Close notification. - close = "ctrl+space"; - - # Close all notifications. - close_all = "ctrl+shift+space"; - - # Redisplay last message(s). - # On the US keyboard layout "grave" is normally above TAB and left - # of "1". - #history = "ctrl+grave"; - - # Context menu. - context = "mod4+u"; - }; - }; - }; -} diff --git a/nixos/homes/palo/i3.nix b/nixos/homes/palo/i3.nix index 7aa50e7..4d8fd69 100644 --- a/nixos/homes/palo/i3.nix +++ b/nixos/homes/palo/i3.nix @@ -25,268 +25,492 @@ in { - home.packages = [ - # we install this to have a terminal with a dark theme - pkgs.kitty - ]; + config = lib.mkIf config.gui.enable { - - programs.i3status-rust = { - enable = true; - bars = { - my = { - icons = "awesome5"; - theme = "gruvbox-light"; - # https://github.com/greshake/i3status-rust/blob/v0.22.0/doc/blocks.md - blocks = [ - { - block = "cpu"; - interval = 1; - } - { - block = "memory"; - format = "$icon $mem_used_percents "; - } - { - block = "load"; - interval = 1; - format = "$icon $1m"; - } - { block = "net"; } - { block = "sound"; } - { - block = "battery"; - interval = 10; - format = "$icon $percentage $time"; - } - { block = "uptime"; } - { - block = "taskwarrior"; - interval = 60; - format = " $icon $count.eng(w:3) todo "; - format_singular = " $icon 1 task "; - format_everything_done = ""; - warning_threshold = 10; - critical_threshold = 20; - filters = [ - { - name = "active"; - filter = "+PENDING and ( +ACTIVE or +DUETODAY or +TODAY or +OVERDUE )"; - } - ]; - } - { - block = "taskwarrior"; - interval = 60; - format = " $icon $count.eng(w:2) "; - format_singular = " $icon 1 task "; - format_everything_done = ""; - warning_threshold = 3; - critical_threshold = 5; - filters = [ - { - name = "started"; - filter = "+PENDING and +ACTIVE"; - } - ]; - } - { - block = "time"; - interval = 60; - format = " $icon $timestamp.datetime(f:'%Y-%m-%d %R', l:de_DE) "; - } - { - block = "tea_timer"; - format = " $icon {$minutes:$seconds |}"; - done_cmd = "${pkgs.noti}/bin/noti -t 'Timer Finished'"; - } - ]; - }; - }; - }; - - programs.alacritty = { - enable = true; - settings = { - font.size = lib.mkForce 6.5; - }; - }; - - services.copyq = { - enable = true; - }; - - xsession.windowManager.i3 = { - enable = true; - extraConfig = '' - default_border pixel - ''; - config = { - modifier = "Mod4"; - terminal = "alacritty"; - focus = { - followMouse = true; - }; - colors.focused = - with config.lib.stylix.colors.withHashtag; - { - # stylix color overrides - border = lib.mkForce base08; - background = lib.mkForce base0A; - text = lib.mkForce base00; - }; - startup = - [ - { command = "${pkgs.albert}/bin/albert"; always = true; } - { command = toString backgroundCommand; always = true; } - { - command = toString (pkgs.writers.writeDash "xsettings" '' - # to allow sudo commands to access X - ${pkgs.xorg.xhost}/bin/xhost + - # no shitty pcspkr crap - ${pkgs.xorg.xset}/bin/xset -b - # no sleeping monitor - ${pkgs.xorg.xset}/bin/xset -dpms - ${pkgs.xorg.xset}/bin/xset s off - ''); - always = true; - } - ]; - bars = [ - (config.lib.stylix.i3.bar // - { - #mode = "hide"; - hiddenState = "hide"; - position = "top"; - workspaceButtons = true; - workspaceNumbers = true; - statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-my.toml"; - fonts.size = 10.0; - trayOutput = "primary"; - } - ) + home.packages = + let + fixXhost = pkgs.writers.writeBashBin "fix-xhost" '' + ${pkgs.xorg.xhost}/bin/xhost + &> /dev/null + ''; + in + [ + fixXhost + pkgs.kitty ]; - keybindings = { - "Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/"; - "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; - "${cfg.config.modifier}+Shift+q" = "exit"; - "${cfg.config.modifier}+q" = "kill"; - "${cfg.config.modifier}+Left" = "focus left"; - "${cfg.config.modifier}+Down" = "focus down"; - "${cfg.config.modifier}+Up" = "focus up"; - "${cfg.config.modifier}+Right" = "focus right"; - "${cfg.config.modifier}+j" = "focus next"; - "${cfg.config.modifier}+k" = "focus prev"; - - "${cfg.config.modifier}+Shift+Left" = "move left"; - "${cfg.config.modifier}+Shift+Down" = "move down"; - "${cfg.config.modifier}+Shift+Up" = "move up"; - "${cfg.config.modifier}+Shift+Right" = "move right"; - - "${cfg.config.modifier}+h" = "split h"; - "${cfg.config.modifier}+v" = "split v"; - "${cfg.config.modifier}+f" = "fullscreen toggle"; - - "${cfg.config.modifier}+s" = "layout stacking"; - "${cfg.config.modifier}+w" = "layout tabbed"; - "${cfg.config.modifier}+e" = "layout toggle split"; - - "${cfg.config.modifier}+t" = "floating toggle"; - #"${cfg.config.modifier}+space" = "focus mode_toggle"; - - "${cfg.config.modifier}+b" = "exec ${backgroundCommand}"; - - "${cfg.config.modifier}+p" = "focus parent"; - - "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; - "${cfg.config.modifier}+minus" = "scratchpad show"; - - "${cfg.config.modifier}+1" = "workspace 1"; - "${cfg.config.modifier}+2" = "workspace 2"; - "${cfg.config.modifier}+3" = "workspace 3"; - "${cfg.config.modifier}+4" = "workspace 4"; - "${cfg.config.modifier}+5" = "workspace 5"; - "${cfg.config.modifier}+6" = "workspace 6"; - "${cfg.config.modifier}+7" = "workspace 7"; - "${cfg.config.modifier}+8" = "workspace 8"; - "${cfg.config.modifier}+9" = "workspace 9"; - "${cfg.config.modifier}+0" = "workspace 10"; - - "${cfg.config.modifier}+Shift+1" = "move container to workspace number 1"; - "${cfg.config.modifier}+Shift+2" = "move container to workspace number 2"; - "${cfg.config.modifier}+Shift+3" = "move container to workspace number 3"; - "${cfg.config.modifier}+Shift+4" = "move container to workspace number 4"; - "${cfg.config.modifier}+Shift+5" = "move container to workspace number 5"; - "${cfg.config.modifier}+Shift+6" = "move container to workspace number 6"; - "${cfg.config.modifier}+Shift+7" = "move container to workspace number 7"; - "${cfg.config.modifier}+Shift+8" = "move container to workspace number 8"; - "${cfg.config.modifier}+Shift+9" = "move container to workspace number 9"; - "${cfg.config.modifier}+Shift+0" = "move container to workspace number 10"; - - "${cfg.config.modifier}+Escape" = "workspace back_and_forth"; - - # rename workspace - "${cfg.config.modifier}+n" = '' - exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' - ''; - - # change to named workspace - "${cfg.config.modifier}+grave" = - let - script = pkgs.writers.writeBash "select-workspace" '' - set -e - set -o pipefail - ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ - ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ - ${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \ - while read line - do - ${pkgs.i3}/bin/i3-msg workspace "$line" - done - ''; - in - "exec ${script}"; - - "${cfg.config.modifier}+Shift+grave" = - let - script = pkgs.writers.writeBash "move-workspace" '' - set -e - set -o pipefail - ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ - ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ - ${pkgs.rofi}/bin/rofi -dmenu -p 'Move to Workspace' | \ - while read line - do - ${pkgs.i3}/bin/i3-msg move container to workspace "$line" - done - ''; - in - "exec ${script}"; - - "${cfg.config.modifier}+Shift+c" = "reload"; - "${cfg.config.modifier}+Shift+r" = "restart"; - "${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; - - "${cfg.config.modifier}+r" = "mode resize"; - - # multiple monitors - # autorandr --save docked # to save setup - # autorandr --save undocked # to save setup - # autorandr --change # automatically detects the setup - "${cfg.config.modifier}+BackSpace" = - let - script = pkgs.writers.writeBash "autorandr" '' - ${pkgs.autorandr}/bin/autorandr --change - ${backgroundCommand} - ''; - in - "exec ${toString script}"; - - # like vimperator - "${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus"; + programs.i3status-rust = { + enable = true; + bars = { + my = { + icons = "awesome5"; + theme = "gruvbox-light"; + # https://github.com/greshake/i3status-rust/blob/v0.22.0/doc/blocks.md + blocks = [ + { + block = "cpu"; + interval = 1; + } + { + block = "memory"; + format = "$icon $mem_used_percents "; + } + { + block = "load"; + interval = 1; + format = "$icon $1m"; + } + { block = "net"; } + { block = "sound"; } + { + block = "battery"; + interval = 10; + format = "$icon $percentage $time"; + } + { block = "uptime"; } + { + block = "taskwarrior"; + interval = 60; + format = " $icon $count.eng(w:3) todo "; + format_singular = " $icon 1 task "; + format_everything_done = ""; + warning_threshold = 10; + critical_threshold = 20; + filters = [ + { + name = "active"; + filter = "+PENDING and ( +ACTIVE or +DUETODAY or +TODAY or +OVERDUE )"; + } + ]; + } + { + block = "taskwarrior"; + interval = 60; + format = " $icon $count.eng(w:2) "; + format_singular = " $icon 1 task "; + format_everything_done = ""; + warning_threshold = 3; + critical_threshold = 5; + filters = [ + { + name = "started"; + filter = "+PENDING and +ACTIVE"; + } + ]; + } + { + block = "time"; + interval = 60; + format = " $icon $timestamp.datetime(f:'%Y-%m-%d %R', l:de_DE) "; + } + { + block = "tea_timer"; + format = " $icon {$minutes:$seconds |}"; + done_cmd = "${pkgs.noti}/bin/noti -t 'Timer Finished'"; + } + ]; + }; }; }; + + programs.alacritty = { + enable = true; + settings = { + font.size = lib.mkForce 6.5; + }; + }; + + services.copyq = { + enable = true; + }; + + xsession.windowManager.i3 = { + enable = true; + extraConfig = '' + default_border pixel + ''; + config = { + modifier = "Mod4"; + terminal = "alacritty"; + focus = { + followMouse = true; + }; + colors.focused = + with config.lib.stylix.colors.withHashtag; + { + # stylix color overrides + border = lib.mkForce base08; + background = lib.mkForce base0A; + text = lib.mkForce base00; + }; + startup = + [ + { command = "${pkgs.albert}/bin/albert"; always = true; } + { command = toString backgroundCommand; always = true; } + { + command = toString (pkgs.writers.writeDash "xsettings" '' + # to allow sudo commands to access X + ${pkgs.xorg.xhost}/bin/xhost + + # no shitty pcspkr crap + ${pkgs.xorg.xset}/bin/xset -b + # no sleeping monitor + ${pkgs.xorg.xset}/bin/xset -dpms + ${pkgs.xorg.xset}/bin/xset s off + ''); + always = true; + } + ]; + bars = [ + (config.lib.stylix.i3.bar // + { + #mode = "hide"; + hiddenState = "hide"; + position = "top"; + workspaceButtons = true; + workspaceNumbers = true; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-my.toml"; + fonts.size = 10.0; + trayOutput = "primary"; + } + ) + ]; + + keybindings = { + "Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/"; + "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; + "${cfg.config.modifier}+Shift+q" = "exit"; + "${cfg.config.modifier}+q" = "kill"; + + "${cfg.config.modifier}+Left" = "focus left"; + "${cfg.config.modifier}+Down" = "focus down"; + "${cfg.config.modifier}+Up" = "focus up"; + "${cfg.config.modifier}+Right" = "focus right"; + "${cfg.config.modifier}+j" = "focus next"; + "${cfg.config.modifier}+k" = "focus prev"; + + "${cfg.config.modifier}+Shift+Left" = "move left"; + "${cfg.config.modifier}+Shift+Down" = "move down"; + "${cfg.config.modifier}+Shift+Up" = "move up"; + "${cfg.config.modifier}+Shift+Right" = "move right"; + + "${cfg.config.modifier}+h" = "split h"; + "${cfg.config.modifier}+v" = "split v"; + "${cfg.config.modifier}+f" = "fullscreen toggle"; + + "${cfg.config.modifier}+s" = "layout stacking"; + "${cfg.config.modifier}+w" = "layout tabbed"; + "${cfg.config.modifier}+e" = "layout toggle split"; + + "${cfg.config.modifier}+t" = "floating toggle"; + #"${cfg.config.modifier}+space" = "focus mode_toggle"; + + "${cfg.config.modifier}+b" = "exec ${backgroundCommand}"; + + "${cfg.config.modifier}+p" = "focus parent"; + + "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.config.modifier}+minus" = "scratchpad show"; + + "${cfg.config.modifier}+1" = "workspace 1"; + "${cfg.config.modifier}+2" = "workspace 2"; + "${cfg.config.modifier}+3" = "workspace 3"; + "${cfg.config.modifier}+4" = "workspace 4"; + "${cfg.config.modifier}+5" = "workspace 5"; + "${cfg.config.modifier}+6" = "workspace 6"; + "${cfg.config.modifier}+7" = "workspace 7"; + "${cfg.config.modifier}+8" = "workspace 8"; + "${cfg.config.modifier}+9" = "workspace 9"; + "${cfg.config.modifier}+0" = "workspace 10"; + + "${cfg.config.modifier}+Shift+1" = "move container to workspace number 1"; + "${cfg.config.modifier}+Shift+2" = "move container to workspace number 2"; + "${cfg.config.modifier}+Shift+3" = "move container to workspace number 3"; + "${cfg.config.modifier}+Shift+4" = "move container to workspace number 4"; + "${cfg.config.modifier}+Shift+5" = "move container to workspace number 5"; + "${cfg.config.modifier}+Shift+6" = "move container to workspace number 6"; + "${cfg.config.modifier}+Shift+7" = "move container to workspace number 7"; + "${cfg.config.modifier}+Shift+8" = "move container to workspace number 8"; + "${cfg.config.modifier}+Shift+9" = "move container to workspace number 9"; + "${cfg.config.modifier}+Shift+0" = "move container to workspace number 10"; + + "${cfg.config.modifier}+Escape" = "workspace back_and_forth"; + + # rename workspace + "${cfg.config.modifier}+n" = '' + exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' + ''; + + # change to named workspace + "${cfg.config.modifier}+grave" = + let + script = pkgs.writers.writeBash "select-workspace" '' + set -e + set -o pipefail + ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ + ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ + ${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \ + while read line + do + ${pkgs.i3}/bin/i3-msg workspace "$line" + done + ''; + in + "exec ${script}"; + + "${cfg.config.modifier}+Shift+grave" = + let + script = pkgs.writers.writeBash "move-workspace" '' + set -e + set -o pipefail + ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ + ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ + ${pkgs.rofi}/bin/rofi -dmenu -p 'Move to Workspace' | \ + while read line + do + ${pkgs.i3}/bin/i3-msg move container to workspace "$line" + done + ''; + in + "exec ${script}"; + + "${cfg.config.modifier}+Shift+c" = "reload"; + "${cfg.config.modifier}+Shift+r" = "restart"; + "${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; + + "${cfg.config.modifier}+r" = "mode resize"; + + # multiple monitors + # autorandr --save docked # to save setup + # autorandr --save undocked # to save setup + # autorandr --change # automatically detects the setup + "${cfg.config.modifier}+BackSpace" = + let + script = pkgs.writers.writeBash "autorandr" '' + ${pkgs.autorandr}/bin/autorandr --change + ${backgroundCommand} + ''; + in + "exec ${toString script}"; + + # like vimperator + "${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus"; + }; + }; + }; + + # notification tool + services.dunst = { + enable = true; + settings = { + global = { + # Allow a small subset of html markup: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # If markup is not allowed, those tags will be stripped out of the + # message. + markup = "yes"; + plain_text = "no"; + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # Markup is allowed + format = '' + %a + %s + %b''; + + # Sort messages by urgency. + sort = "yes"; + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = "yes"; + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = "center"; + + # The frequency with wich text that is longer than the notification + # window allows bounces back and forth. + # This option conflicts with "word_wrap". + # Set to 0 to disable. + bounce_freq = 0; + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 1; + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = "yes"; + + # Ignore newlines '\n' in notifications. + ignore_newline = "no"; + + # Hide duplicate's count and stack them + stack_duplicates = "yes"; + hide_duplicates_count = "no"; + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectevly. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + geometry = "500x10-0+0"; + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = "no"; + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + idle_threshold = 0; + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing windowmanager is + # present (e.g. xcompmgr, compiz, etc.). + # transparency = 5 + + # Which monitor should the notifications be displayed on. + #monitor = keyboard + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a windowmanager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern windowmanagers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = "none"; + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = "yes"; + + # Maximum amount of notifications kept in history + history_length = 15; + + # Display indicators for URLs (U) and actions (A). + show_indicators = "no"; + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + # This adds empty space above and under the text. + line_height = 3; + + # Draw a line of "separatpr_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 1; + + # Padding between text and separator. + padding = 1; + + # Horizontal padding. + horizontal_padding = 1; + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = true; + + # Align icons left/right/off + icon_position = "off"; + max_icon_size = 80; + frame_width = 2; + }; + shortcuts = { + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = "ctrl+space"; + + # Close all notifications. + close_all = "ctrl+shift+space"; + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + #history = "ctrl+grave"; + + # Context menu. + context = "mod4+u"; + }; + }; + }; + + xdg.configFile."albert/albert.conf".text = '' + [General] + hotkey=Meta+Space + showTray=false + telemetry=false + terminal=urxvt -e + + [org.albert.extension.applications] + enabled=true + fuzzy=true + use_generic_name=true + use_keywords=true + + [org.albert.extension.calculator] + enabled=true + + [org.albert.extension.hashgenerator] + enabled=true + + [org.albert.frontend.widgetboxmodel] + alwaysOnTop=true + clearOnHide=false + displayIcons=true + displayScrollbar=false + displayShadow=false + hideOnClose=false + hideOnFocusLoss=true + itemCount=5 + showCentered=true + theme=SolarizedBrightViolet + ''; + + xdg.configFile."Code/User/settings.json".text = builtins.toJSON { + "keyboard.dispatch" = "keyCode"; + "explorer.confirmDragAndDrop" = false; + "editor.tabSize" = 2; + "window.zoomLevel" = -1; + "git.enableSmartCommit" = true; + "files.autoSave" = "onFocusChange"; + "terminal.integrated.setLocaleVariables" = true; + "terminal.external.linuxExec" = "xterm"; + "explorer.confirmDelete" = false; + "todo-tree.tags" = [ "todo" "TODO" "fixme" "FIXME" ]; + "workbench.colorTheme" = "Solarized Light"; + }; + + }; }