From 83bccd8c3f87217183e850b87dd70724c2c3339e Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Fri, 21 Jan 2022 16:18:38 +0100 Subject: [PATCH] misc changes --- home/alacritty/default.nix | 3 +- home/default.nix | 6 +- home/desktop-sway/bemenu.nix | 39 +++++++++ home/desktop-sway/default.nix | 2 +- home/desktop-sway/sway.nix | 65 ++++++++++----- home/desktop-sway/waybar.nix | 2 +- home/desktop-sway/wofi-pass.nix | 30 ------- home/desktop-sway/wofi.nix | 57 ------------- home/desktop-xmonad/default.nix | 96 +--------------------- home/desktop-xmonad/rofi.nix | 140 ++++++++++++++++++++++++++++++++ 10 files changed, 231 insertions(+), 209 deletions(-) create mode 100644 home/desktop-sway/bemenu.nix delete mode 100644 home/desktop-sway/wofi-pass.nix delete mode 100644 home/desktop-sway/wofi.nix create mode 100644 home/desktop-xmonad/rofi.nix diff --git a/home/alacritty/default.nix b/home/alacritty/default.nix index d413926..fc5fb11 100644 --- a/home/alacritty/default.nix +++ b/home/alacritty/default.nix @@ -9,7 +9,8 @@ x = 0; y = 0; }; - size = 7; + # size = 7; + size = 9; }; }; }; diff --git a/home/default.nix b/home/default.nix index 0d6f99a..7902141 100644 --- a/home/default.nix +++ b/home/default.nix @@ -4,6 +4,7 @@ let impermanence = builtins.fetchTarball { url = "https://github.com/nix-community/impermanence/archive/master.tar.gz"; }; + in { # Let Home Manager install and manage itself. # programs.home-manager.enable = true; @@ -15,13 +16,13 @@ in { imports = [ "${impermanence}/home-manager.nix" - # ./desktop-sway + ./desktop-sway ./alacritty ./arduino ./barrier ./browsers ./dav - ./desktop-xmonad + # ./desktop-xmonad ./fonts ./git ./gotify @@ -106,6 +107,7 @@ in { CM_LAUNCHER = "rofi"; # for clipmenu LEDGER_FILE = "${config.home.homeDirectory}/finance/2021.journal"; QT_QPA_PLATFORMTHEME = "qt5ct"; + }; home.packages = with pkgs; [ diff --git a/home/desktop-sway/bemenu.nix b/home/desktop-sway/bemenu.nix new file mode 100644 index 0000000..011b1bf --- /dev/null +++ b/home/desktop-sway/bemenu.nix @@ -0,0 +1,39 @@ +{ config, pkgs, ... }: + +let + bemenuColors = { + titleBackground = "#282828E0"; + titleForeground = "#fbf1c7"; + filterBackground = "#282828E0"; + filterForeground = "#ebdbb2"; + normalBackground = "#282828E0"; + normalForeground = "#ebdbb2"; + highlightedBackground = "#458588E0"; + highlightedForeground = "#fbf1c7"; + scrollbarBackground = "#282828E0"; + scrollbarForeground = "#458588E0"; + }; +in { + home.packages = [ pkgs.bemenu ]; + home.sessionVariables.BEMENU_OPTS = '' + --ignorecase \ + --list 20 \ + --prompt '❯' \ + --scrollbar none \ + --wrap \ + --scrollbar autohide \ + --no-overlap \ + --monitor all \ + --fn 'Inter 13px' \ + --tb '${bemenuColors.titleBackground}' \ + --tf '${bemenuColors.titleForeground}' \ + --fb '${bemenuColors.filterBackground}' \ + --ff '${bemenuColors.filterForeground}' \ + --nb '${bemenuColors.normalBackground}' \ + --nf '${bemenuColors.normalForeground}' \ + --hb '${bemenuColors.highlightedBackground}' \ + --hf '${bemenuColors.highlightedForeground}' \ + --scb '${bemenuColors.scrollbarBackground}' \ + --scf '${bemenuColors.scrollbarForeground}' + ''; +} diff --git a/home/desktop-sway/default.nix b/home/desktop-sway/default.nix index 9250cac..f3455fb 100644 --- a/home/desktop-sway/default.nix +++ b/home/desktop-sway/default.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: { - imports = [ ./sway.nix ./waybar.nix ./wofi.nix ]; + imports = [ ./sway.nix ./waybar.nix ./bemenu.nix ]; home.packages = with pkgs; [ swaylock diff --git a/home/desktop-sway/sway.nix b/home/desktop-sway/sway.nix index ed39444..dfcad3e 100644 --- a/home/desktop-sway/sway.nix +++ b/home/desktop-sway/sway.nix @@ -2,19 +2,35 @@ let cfg = config.wayland.windowManager.sway.config; - wofi_pass = pkgs.callPackage ./wofi-pass.nix { inherit config pkgs; }; pactl = "${pkgs.pulseaudio}/bin/pactl"; brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; playerctl = "${pkgs.playerctl}/bin/playerctl"; -in -{ + wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled"; + + # todo: do it properly like in https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/security/pass/rofi-pass.nix + tessenSrc = builtins.fetchTarball { + url = + "https://github.com/ayushnix/tessen/releases/download/v1.3.1/tessen-1.3.1.tar.gz"; + }; + + tessen = pkgs.runCommandLocal "tessen" { + nativeBuildInputs = [ pkgs.makeWrapper ]; + } '' + install -m755 ${tessenSrc}/tessen -D $out/bin/tessen + patchShebangs $out/bin/tessen + wrapProgram $out/bin/tessen \ + --prefix PATH: ${pkgs.lib.makeBinPath [ pkgs.bash ]} + ''; + +in { + home.packages = [ tessen ]; wayland.windowManager.sway = { enable = true; wrapperFeatures.gtk = true; config = { modifier = "Mod4"; terminal = "alacritty"; - menu = "${pkgs.wofi}/bin/wofi --show run"; + menu = "${pkgs.bemenu}/bin/bemenu-run"; left = "h"; down = "j"; @@ -24,7 +40,8 @@ in output = { "LVDS-1" = { resolution = "1366x768"; - bg = "~/Images/wallpapers/times_of_grace.jpg fill"; + bg = + "`${pkgs.findutils}/bin/find ${wallpapers} -type f | ${pkgs.coreutils}/bin/shuf -n 1` fill"; }; }; @@ -44,20 +61,21 @@ in "${cfg.modifier}+Shift+Escape" = "exec ${pkgs.sway}/bin/swaymsg exit"; "${cfg.modifier}+Escape" = "exec ${pkgs.swaylock}/bin/swaylock"; - "${cfg.modifier}+${cfg.left}" = "focus left"; - "${cfg.modifier}+${cfg.down}" = "focus down"; - "${cfg.modifier}+${cfg.up}" = "focus up"; + "${cfg.modifier}+${cfg.left}" = "focus left"; + "${cfg.modifier}+${cfg.down}" = "focus down"; + "${cfg.modifier}+${cfg.up}" = "focus up"; "${cfg.modifier}+${cfg.right}" = "focus right"; - "${cfg.modifier}+Shift+${cfg.left}" = "move left"; - "${cfg.modifier}+Shift+${cfg.down}" = "move down"; - "${cfg.modifier}+Shift+${cfg.up}" = "move up"; + "${cfg.modifier}+Shift+${cfg.left}" = "move left"; + "${cfg.modifier}+Shift+${cfg.down}" = "move down"; + "${cfg.modifier}+Shift+${cfg.up}" = "move up"; "${cfg.modifier}+Shift+${cfg.right}" = "move right"; - "${cfg.modifier}+Control+${cfg.left}" = "move workspace to output left"; - "${cfg.modifier}+Control+${cfg.down}" = "move workspace to output down"; - "${cfg.modifier}+Control+${cfg.up}" = "move workspace to output up"; - "${cfg.modifier}+Control+${cfg.right}" = "move workspace to output right"; + "${cfg.modifier}+Control+${cfg.left}" = "move workspace to output left"; + "${cfg.modifier}+Control+${cfg.down}" = "move workspace to output down"; + "${cfg.modifier}+Control+${cfg.up}" = "move workspace to output up"; + "${cfg.modifier}+Control+${cfg.right}" = + "move workspace to output right"; "${cfg.modifier}+Shift+w" = "move window to output left"; "${cfg.modifier}+Shift+e" = "move window to output right"; @@ -101,14 +119,17 @@ in "${cfg.modifier}+space" = "layout toggle all"; "${cfg.modifier}+Shift+space" = "layout default"; - "${cfg.modifier}+p" = "exec ${wofi_pass}/bin/wofi-pass"; + "${cfg.modifier}+p" = "exec ${tessen}/bin/tessen"; - "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; - "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"; - "XF86AudioMute" = "exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioMicMute" = "exec ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle"; + "XF86AudioRaiseVolume" = + "exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = + "exec ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = + "exec ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle"; "XF86MonBrightnessDown" = "exec ${brightnessctl} set 5%-"; - "XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%"; + "XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%"; "XF86AudioPlay" = "exec ${playerctl} play-pause"; "XF86AudioNext" = "exec ${playerctl} next"; "XF86AudioPrev" = "exec ${playerctl} previous"; @@ -139,7 +160,7 @@ in window.border = 3; workspaceAutoBackAndForth = true; - bars = []; + bars = [ ]; }; }; diff --git a/home/desktop-sway/waybar.nix b/home/desktop-sway/waybar.nix index 77fc35c..4f6cb28 100644 --- a/home/desktop-sway/waybar.nix +++ b/home/desktop-sway/waybar.nix @@ -71,7 +71,7 @@ format-muted = "ﱝ"; }; - tray.icon-size = 10; + tray.icon-size = 14; }; } ]; diff --git a/home/desktop-sway/wofi-pass.nix b/home/desktop-sway/wofi-pass.nix deleted file mode 100644 index d3ef3ba..0000000 --- a/home/desktop-sway/wofi-pass.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ config, pkgs, ... }: - -let - bash = "${pkgs.bash}/bin/bash"; - wofi = "${pkgs.wofi}/bin/wofi"; - pass = "${pkgs.pass}/bin/pass"; - wtype = "${pkgs.wtype}/bin/wtype"; - xargs = "${pkgs.findutils}/bin/xargs"; - wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy"; - prefix = "${config.home.homeDirectory}/.password-store"; -in - pkgs.writeScriptBin "wofi-pass" '' - #!${bash} - - password_files=( "${prefix}"/**/*.gpg ) - password_files=( "''${password_files[@]#"${prefix}"/}" ) - password_files=( "''${password_files[@]%.gpg}" ) - - sel=$( - printf '%s\n' "''${password_files[@]}" | \ - ${wofi} --dmenu "$@" - ) - - #[ -n "''${sel}" ] && \ - # ${pass} show "''${sel}" | \ - # ${xargs} ${wtype} - - [ -n "''${sel}" ] && \ - ${pass} show "''${sel}" | ${wl-copy} - '' diff --git a/home/desktop-sway/wofi.nix b/home/desktop-sway/wofi.nix deleted file mode 100644 index d2f165f..0000000 --- a/home/desktop-sway/wofi.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ config, pkgs, ... }: - -let - wofi_pass = pkgs.callPackage ./wofi-pass.nix { inherit config pkgs; }; -in -{ - - home.packages = [ pkgs.wofi wofi_pass ]; - - home.file.".config/wofi/style.css".text = '' - * { - font-family: Inter; - } - - #outer-box { - border: 2px solid #458588; - padding: 5px; - padding-bottom: 0px; - } - - window { - background-color: rgba(40, 40, 40, 0.9); - } - - #entry { - border-radius: 0px; - } - - #input { - border-radius: 0px; - background-color: #282828; - border: none; - border-bottom: 1px solid #928374; - margin-bottom: 5px; - background-color: transparent; - } - - #entry:selected { - background-color: rgba(69, 133, 136, 0.9); - } - - #text { - color: #ebdbb2; - } - - #text:selected { - background-color: transparent; - color: #fbf1c7; - } - - #scroll { - margin: 0px; - border: none; - } - - ''; -} diff --git a/home/desktop-xmonad/default.nix b/home/desktop-xmonad/default.nix index c09fad2..8f3000c 100644 --- a/home/desktop-xmonad/default.nix +++ b/home/desktop-xmonad/default.nix @@ -55,7 +55,7 @@ let in { - imports = [ ./autorandr.nix ./misc.nix ]; + imports = [ ./autorandr.nix ./rofi.nix ./misc.nix ]; home = { keyboard = { layout = "us"; @@ -178,100 +178,6 @@ in ''; }; - programs.rofi = { - enable = true; - font = "${font.name} ${font.size}"; - extraConfig = { - display-run = " "; - # display-drun = " "; - display-window = " "; - drun-display-format = "{name}"; - modi = "window,run,drun,ssh"; - show-icons = false; - }; - theme = let - inherit (config.lib.formats.rasi) mkLiteral; - in { - "*" = { - background-color = mkLiteral "transparent"; - border = 0; - margin = 0; - padding = 0; - spacing = 0; - }; - element = { - padding = 2; - orientation = "vertical"; - }; - "element-text" = { - text-color = mkLiteral colors.fg; - }; - - "element selected" = { - text-color = mkLiteral colors.selFg; - background-color = mkLiteral "${colors.sel}A0"; - }; - entry = { - padding = mkLiteral "0 0 6 3"; - text-color = mkLiteral colors.fg; - }; - inputbar = { - children = map mkLiteral ["prompt" "entry"]; - border = mkLiteral "0 0 1 0"; - border-color = mkLiteral gruvbox-dark.gray2; - margin = mkLiteral "0 0 5 0"; - }; - listview = { - columns = 1; - fixed-height = false; - }; - mainbox = { - children = map mkLiteral ["inputbar" "listview"]; - margin = 6; - }; - prompt = { - padding = mkLiteral "0 0 0 6"; - text-color = mkLiteral colors.fg; - background-color = mkLiteral "transparent"; - }; - window = { - transparency = "real"; - background-color = mkLiteral "${colors.bg}D0"; - y-offset = mkLiteral "-25%"; - border = 2; - border-color = mkLiteral colors.sel; - }; - }; - terminal = "${pkgs.alacritty}/bin/alacritty"; - pass = { - enable = true; - extraConfig = '' - URL_field='url' - USERNAME_field='user' - AUTOTYPE_field='autotype' - delay=2 - wait=0.2 - xdotool_delay=12 - EDITOR='gvim -f' - BROWSER='xdg-open' - default_do='typePass' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl - auto_enter='false' - notify='false' - default_autotype='user :tab pass' - help_color="${gruvbox-dark.blue-light}" - clip=primary - clip_clear=45 - edit_new_pass="true" - default_user=":filename" - autotype="Alt+1" - type_user="Alt+u" - type_pass="Alt+p" - copy_name="" - copy_pass="" - ''; - }; - }; - services.dunst = { enable = true; iconTheme = { diff --git a/home/desktop-xmonad/rofi.nix b/home/desktop-xmonad/rofi.nix new file mode 100644 index 0000000..6196fb1 --- /dev/null +++ b/home/desktop-xmonad/rofi.nix @@ -0,0 +1,140 @@ +{ config, pkgs, ... }: + +let + gruvbox-dark = { + bg = "#282828"; + bg1 = "#3c3836"; + bg2 = "#504945"; + + fg = "#ebdbb2"; + fg0 = "#fbf1c7"; + fg3 = "#bdae93"; + + red = "#cc241d"; + green = "#98971a"; + yellow = "#d79921"; + blue = "#458588"; + purple = "#b16286"; + aqua = "#689d6a"; + gray = "#a89984"; + + gray2 = "#928374"; + red-light = "#fb4934"; + green-light = "#b8bb26"; + yellow-light = "#fabd2f"; + blue-light = "#83a598"; + purple-light = "#d3869b"; + aqua-light = "#8ec07c"; + + }; + colors = { + fg = gruvbox-dark.fg; + selFg = gruvbox-dark.fg0; + bg = gruvbox-dark.bg; + sel = gruvbox-dark.blue; + inactive = gruvbox-dark.gray; + inactiveBorder = gruvbox-dark.bg2; + urgent = gruvbox-dark.red; + }; + rofiTransparency = "96"; + font = { + name = "Inter"; + size = "10"; + }; + monoFont = { + name = "Hack"; + size = "9"; + }; + +in { + programs.rofi = { + enable = true; + font = "${font.name} ${font.size}"; + extraConfig = { + display-run = " "; + # display-drun = " "; + display-window = " "; + drun-display-format = "{name}"; + modi = "window,run,drun,ssh"; + show-icons = false; + }; + theme = let inherit (config.lib.formats.rasi) mkLiteral; + in { + "*" = { + background-color = mkLiteral "transparent"; + border = 0; + margin = 0; + padding = 0; + spacing = 0; + }; + element = { + padding = 2; + orientation = "vertical"; + }; + "element-text" = { text-color = mkLiteral colors.fg; }; + + "element selected" = { + text-color = mkLiteral colors.selFg; + background-color = mkLiteral "${colors.sel}A0"; + }; + entry = { + padding = mkLiteral "0 0 6 3"; + text-color = mkLiteral colors.fg; + }; + inputbar = { + children = map mkLiteral [ "prompt" "entry" ]; + border = mkLiteral "0 0 1 0"; + border-color = mkLiteral gruvbox-dark.gray2; + margin = mkLiteral "0 0 5 0"; + }; + listview = { + columns = 1; + fixed-height = false; + }; + mainbox = { + children = map mkLiteral [ "inputbar" "listview" ]; + margin = 6; + }; + prompt = { + padding = mkLiteral "0 0 0 6"; + text-color = mkLiteral colors.fg; + background-color = mkLiteral "transparent"; + }; + window = { + transparency = "real"; + background-color = mkLiteral "${colors.bg}D0"; + y-offset = mkLiteral "-25%"; + border = 2; + border-color = mkLiteral colors.sel; + }; + }; + terminal = "${pkgs.alacritty}/bin/alacritty"; + pass = { + enable = true; + extraConfig = '' + URL_field='url' + USERNAME_field='user' + AUTOTYPE_field='autotype' + delay=2 + wait=0.2 + xdotool_delay=12 + EDITOR='gvim -f' + BROWSER='xdg-open' + default_do='typePass' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl + auto_enter='false' + notify='false' + default_autotype='user :tab pass' + help_color="${gruvbox-dark.blue-light}" + clip=primary + clip_clear=45 + edit_new_pass="true" + default_user=":filename" + autotype="Alt+1" + type_user="Alt+u" + type_pass="Alt+p" + copy_name="" + copy_pass="" + ''; + }; + }; +}