From cdf9652a34a9a8efe662ffa95948d330920fb6cd Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 16 Jun 2023 07:23:35 -0400 Subject: [PATCH] meta: Use separate home-manager modules This makes it easier to use our modules with home-manager on non-NixOS distributions as needed. --- modules/default.nix | 25 +-- modules/dunst/default.nix | 46 +++-- modules/feh/default.nix | 146 ++++++++-------- modules/git/default.nix | 102 ++++++------ modules/gpg/default.nix | 44 +++-- modules/kitty/default.nix | 46 +++-- modules/mime-apps/default.nix | 28 ++-- modules/mpv/default.nix | 66 ++++---- modules/ncmpcpp/default.nix | 106 ++++++------ modules/qutebrowser/default.nix | 268 +++++++++++++++--------------- modules/rofi/default.nix | 44 +++-- modules/waybar/default.nix | 286 ++++++++++++++++---------------- modules/zathura/default.nix | 24 ++- 13 files changed, 593 insertions(+), 638 deletions(-) diff --git a/modules/default.nix b/modules/default.nix index ee247d10..111ed443 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,31 +1,34 @@ { imports = [ ./dual-function-keys - ./dunst ./fcitx5-mozc - ./feh ./fish-starship ./fonts - ./git - ./gpg ./hyprland ./joshuto - ./kitty ./librewolf - ./mime-apps - ./mpv - ./ncmpcpp ./neovim ./piper ./pipewire - ./qutebrowser - ./rofi ./stylix ./swaylock ./thunar - ./waybar ./waycorner ./xdg-user-dirs + ]; + + home-manager.sharedModules = [ + ./dunst + ./feh + ./git + ./gpg + ./kitty + ./mime-apps + ./mpv + ./ncmpcpp + ./qutebrowser + ./rofi + ./waybar ./zathura ]; } diff --git a/modules/dunst/default.nix b/modules/dunst/default.nix index ea0bd7ff..177a0350 100644 --- a/modules/dunst/default.nix +++ b/modules/dunst/default.nix @@ -1,30 +1,26 @@ { pkgs, ... }: { - environment.systemPackages = [ pkgs.libnotify ]; + home.pkgs = with pkgs; [ libnotify ]; - home-manager.sharedModules = [ - { - services.dunst = { - enable = true; + services.dunst = { + enable = true; - settings = { - global = { - geometry = "1870x5-25+45"; - width = 350; - separator_height = 5; - padding = 24; - horizontal_padding = 24; - frame_width = 3; - idle_threshold = 120; - alignment = "center"; - word_wrap = "yes"; - transparency = 5; - format = "%s: %b"; - markup = "full"; - min_icon_size = 128; - max_icon_size = 128; - }; - }; + settings = { + global = { + geometry = "1870x5-25+45"; + width = 350; + separator_height = 5; + padding = 24; + horizontal_padding = 24; + frame_width = 3; + idle_threshold = 120; + alignment = "center"; + word_wrap = "yes"; + transparency = 5; + format = "%s: %b"; + markup = "full"; + min_icon_size = 128; + max_icon_size = 128; }; - } - ]; + }; + }; } diff --git a/modules/feh/default.nix b/modules/feh/default.nix index e29405f1..7ff00739 100644 --- a/modules/feh/default.nix +++ b/modules/feh/default.nix @@ -1,81 +1,77 @@ { - home-manager.sharedModules = [ - { - programs.feh = { - enable = true; + programs.feh = { + enable = true; - keybindings = { - next_img = [ "k" "Right" ]; - prev_img = [ "j" "Left" ]; - quit = "q"; - toggle_fullscreen = "f"; + keybindings = { + next_img = [ "k" "Right" ]; + prev_img = [ "j" "Left" ]; + quit = "q"; + toggle_fullscreen = "f"; - zoom_in = "h"; - zoom_out = "l"; + zoom_in = "h"; + zoom_out = "l"; - toggle_filenames = "d"; - toggle_fixed_geometry = "g"; - toggle_pause = "h"; - toggle_pointer = "a"; - size_to_image = "w"; - jump_random = "z"; - jump_first = "J"; - jump_last = "K"; - jump_fwd = "H"; - jump_back = "L"; - scroll_left = "b"; - scroll_right = "n"; - scroll_up = [ "u" "Up" ]; - scroll_down = [ "d" "Down" ]; - zoom_default = "o"; - zoom_fill = "p"; - toggle_auto_zoom = "m"; + toggle_filenames = "d"; + toggle_fixed_geometry = "g"; + toggle_pause = "h"; + toggle_pointer = "a"; + size_to_image = "w"; + jump_random = "z"; + jump_first = "J"; + jump_last = "K"; + jump_fwd = "H"; + jump_back = "L"; + scroll_left = "b"; + scroll_right = "n"; + scroll_up = [ "u" "Up" ]; + scroll_down = [ "d" "Down" ]; + zoom_default = "o"; + zoom_fill = "p"; + toggle_auto_zoom = "m"; - toggle_actions = null; - toggle_aliasing = null; - toggle_caption = null; - toggle_exif = null; - save_filelist = null; - toggle_info = null; - toggle_keep_vp = null; - toggle_menu = null; - reload_image = null; - save_image = null; - prev_dir = null; - next_dir = null; - orient_3 = null; - orient_1 = null; - flip = null; - mirror = null; - action_0 = null; - action_1 = null; - action_2 = null; - action_3 = null; - action_4 = null; - action_5 = null; - action_6 = null; - action_7 = null; - action_8 = null; - action_9 = null; - close = null; - reload_plus = null; - reload_minus = null; - remove = null; - delete = null; - scroll_left_page = null; - scroll_right_page = null; - scroll_up_page = null; - scroll_down_page = null; - render = null; - zoom_fit = null; - menu_close = null; - menu_up = null; - menu_down = null; - menu_parent = null; - menu_child = null; - menu_select = null; - }; - }; - } - ]; + toggle_actions = null; + toggle_aliasing = null; + toggle_caption = null; + toggle_exif = null; + save_filelist = null; + toggle_info = null; + toggle_keep_vp = null; + toggle_menu = null; + reload_image = null; + save_image = null; + prev_dir = null; + next_dir = null; + orient_3 = null; + orient_1 = null; + flip = null; + mirror = null; + action_0 = null; + action_1 = null; + action_2 = null; + action_3 = null; + action_4 = null; + action_5 = null; + action_6 = null; + action_7 = null; + action_8 = null; + action_9 = null; + close = null; + reload_plus = null; + reload_minus = null; + remove = null; + delete = null; + scroll_left_page = null; + scroll_right_page = null; + scroll_up_page = null; + scroll_down_page = null; + render = null; + zoom_fit = null; + menu_close = null; + menu_up = null; + menu_down = null; + menu_parent = null; + menu_child = null; + menu_select = null; + }; + }; } diff --git a/modules/git/default.nix b/modules/git/default.nix index 0878619b..242a545a 100644 --- a/modules/git/default.nix +++ b/modules/git/default.nix @@ -1,62 +1,58 @@ { pkgs, ... }: let VARIABLES = import ../../src/variables.nix; in { - environment.systemPackages = with pkgs; [ tig git ]; + home.packages = with pkgs; [ tig ]; - home-manager.sharedModules = [ - { - xdg.configFile."tig/config".text = '' - color cursor black green bold - color title-focus black blue bold - color title-blur black blue bold - ''; + xdg.configFile."tig/config".text = '' + color cursor black green bold + color title-focus black blue bold + color title-blur black blue bold + ''; - programs.git = { - enable = true; + programs.git = { + enable = true; - extraConfig = { - include.path = "~/.gituser"; - commit.gpgsign = true; + extraConfig = { + include.path = "~/.gituser"; + commit.gpgsign = true; - core = { - editor = "nvim"; - autocrlf = false; - quotePath = false; - }; - - web.browser = VARIABLES.defaultBrowser; - push.default = "simple"; - branch.autosetuprebase = "always"; - init.defaultBranch = "master"; - rerere.enabled = true; - color.ui = true; - - alias = { - contrib = "shortlog -n -s"; - remotes = "remote -v"; - praise = "blame"; - verify = "log --show-signature"; - }; - - "color \"diff-highlight\"" = { - oldNormal = "red bold"; - oldHighlight = "red bold"; - newNormal = "green bold"; - newHighlight = "green bold"; - }; - - "color \"diff\"" = { - meta = "yellow"; - frag = "magenta bold"; - commit = "yellow bold"; - old = "red bold"; - new = "green bold"; - whitespace = "red reverse"; - }; - }; - - diff-so-fancy.enable = true; + core = { + editor = "nvim"; + autocrlf = false; + quotePath = false; }; - } - ]; + + web.browser = VARIABLES.defaultBrowser; + push.default = "simple"; + branch.autosetuprebase = "always"; + init.defaultBranch = "master"; + rerere.enabled = true; + color.ui = true; + + alias = { + contrib = "shortlog -n -s"; + remotes = "remote -v"; + praise = "blame"; + verify = "log --show-signature"; + }; + + "color \"diff-highlight\"" = { + oldNormal = "red bold"; + oldHighlight = "red bold"; + newNormal = "green bold"; + newHighlight = "green bold"; + }; + + "color \"diff\"" = { + meta = "yellow"; + frag = "magenta bold"; + commit = "yellow bold"; + old = "red bold"; + new = "green bold"; + whitespace = "red reverse"; + }; + }; + + diff-so-fancy.enable = true; + }; } diff --git a/modules/gpg/default.nix b/modules/gpg/default.nix index e3b71062..566a5947 100644 --- a/modules/gpg/default.nix +++ b/modules/gpg/default.nix @@ -1,27 +1,23 @@ { - home-manager.sharedModules = [ - { - programs.gpg = { - enable = true; - # homedir = "${config.xdg.dataHome}/gnupg" - settings = { - personal-digest-preferences = "SHA512"; - cert-digest-algo = "SHA512"; - cipher-algo = "AES256"; - default-preference-list = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed"; - personal-cipher-preferences = "TWOFISH CAMELLIA256 AES 3DES"; - throw-keyids = true; - keyid-format = "0xlong"; - with-fingerprint = true; - }; - }; + programs.gpg = { + enable = true; + # homedir = "${config.xdg.dataHome}/gnupg" + settings = { + personal-digest-preferences = "SHA512"; + cert-digest-algo = "SHA512"; + cipher-algo = "AES256"; + default-preference-list = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed"; + personal-cipher-preferences = "TWOFISH CAMELLIA256 AES 3DES"; + throw-keyids = true; + keyid-format = "0xlong"; + with-fingerprint = true; + }; + }; - services.gpg-agent = { - enable = true; - pinentryFlavor = "curses"; - defaultCacheTtl = 43200; - maxCacheTtl = 43200; - }; - } - ]; + services.gpg-agent = { + enable = true; + pinentryFlavor = "curses"; + defaultCacheTtl = 43200; + maxCacheTtl = 43200; + }; } diff --git a/modules/kitty/default.nix b/modules/kitty/default.nix index 8c58f6ad..56ddfb43 100644 --- a/modules/kitty/default.nix +++ b/modules/kitty/default.nix @@ -1,32 +1,28 @@ let VARIABLES = import ../../src/variables.nix; in { - home-manager.sharedModules = [ - { - programs.kitty = { - enable = true; + programs.kitty = { + enable = true; - settings = { - enable_audio_bell = false; - close_on_child_death = true; - cursor_blink_interval = 0; + settings = { + enable_audio_bell = false; + close_on_child_death = true; + cursor_blink_interval = 0; - open_url_with = VARIABLES.defaultBrowser; - wayland_titlebar_color = "background"; + open_url_with = VARIABLES.defaultBrowser; + wayland_titlebar_color = "background"; - allow_remote_control = true; - listen_on = "unix:/tmp/kitty"; - dynamic_background_opacity = true; + allow_remote_control = true; + listen_on = "unix:/tmp/kitty"; + dynamic_background_opacity = true; - window_padding_width = 5; - tab_bar_margin_width = 5; - }; - }; + window_padding_width = 5; + tab_bar_margin_width = 5; + }; + }; - xdg.configFile."kitty/diff.conf".text = '' - map d scroll_to next-page - map u scroll_to prev-page - map g scroll_to start - map G scroll_to end - ''; - } - ]; + xdg.configFile."kitty/diff.conf".text = '' + map d scroll_to next-page + map u scroll_to prev-page + map g scroll_to start + map G scroll_to end + ''; } diff --git a/modules/mime-apps/default.nix b/modules/mime-apps/default.nix index a9d4b6ed..3d67e07d 100644 --- a/modules/mime-apps/default.nix +++ b/modules/mime-apps/default.nix @@ -1,18 +1,14 @@ let VARIABLES = import ../../src/variables.nix; in { - home-manager.sharedModules = [ - { - xdg.mimeApps = { - enable = true; - defaultApplications = { - "image/png" = "feh.desktop"; - "image/jpeg" = "feh.desktop"; - "image/gif" = "org.qutebrowser.qutebrowser.desktop"; - "application/x-wine-extension-osz" = "osu-stable.desktop"; - "application/x-vmware-vm" = "vmware-workstation.desktop"; - "x-scheme-handler/http" = "${VARIABLES.defaultBrowser}.desktop"; - "x-scheme-handler/https" = "${VARIABLES.defaultBrowser}.desktop"; - }; - }; - } - ]; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "image/png" = "feh.desktop"; + "image/jpeg" = "feh.desktop"; + "image/gif" = "org.qutebrowser.qutebrowser.desktop"; + "application/x-wine-extension-osz" = "osu-stable.desktop"; + "application/x-vmware-vm" = "vmware-workstation.desktop"; + "x-scheme-handler/http" = "${VARIABLES.defaultBrowser}.desktop"; + "x-scheme-handler/https" = "${VARIABLES.defaultBrowser}.desktop"; + }; + }; } diff --git a/modules/mpv/default.nix b/modules/mpv/default.nix index 1cbd4e7c..66962516 100644 --- a/modules/mpv/default.nix +++ b/modules/mpv/default.nix @@ -1,36 +1,34 @@ { pkgs, ... }: { - home-manager.sharedModules = [ - { - programs.mpv = { - enable = true; - config = { - screenshot-format = "png"; - profile = "gpu-hq"; - scale = "ewa_lanczossharp"; - cscale = "ewa_lanczossharp"; - video-sync = "display-resample"; - interpolation = true; - tscale = "oversample"; - sub-auto = "fuzzy"; - sub-font = "Noto Sans CJK JP Medium"; - sub-blur = 10; - sub-file-paths = "subs:subtitles:字幕"; - fullscreen = "yes"; - title = "\${filename} - mpv"; - script-opts = "osc-title=\${filename},osc-boxalpha=150,osc-showfullscreen=no,osc-boxvideo=yes"; - osc = "no"; - osd-on-seek = "no"; - osd-bar = "no"; - osd-bar-w = 30; - osd-bar-h = "0.2"; - osd-duration = 750; - really-quiet = "yes"; - }; - scripts = with pkgs.mpvScripts; [ - mpris - thumbnail - ]; - }; - } - ]; + programs.mpv = { + enable = true; + + config = { + screenshot-format = "png"; + profile = "gpu-hq"; + scale = "ewa_lanczossharp"; + cscale = "ewa_lanczossharp"; + video-sync = "display-resample"; + interpolation = true; + tscale = "oversample"; + sub-auto = "fuzzy"; + sub-font = "Noto Sans CJK JP Medium"; + sub-blur = 10; + sub-file-paths = "subs:subtitles:字幕"; + fullscreen = "yes"; + title = "\${filename} - mpv"; + script-opts = "osc-title=\${filename},osc-boxalpha=150,osc-showfullscreen=no,osc-boxvideo=yes"; + osc = "no"; + osd-on-seek = "no"; + osd-bar = "no"; + osd-bar-w = 30; + osd-bar-h = "0.2"; + osd-duration = 750; + really-quiet = "yes"; + }; + + scripts = with pkgs.mpvScripts; [ + mpris + thumbnail + ]; + }; } diff --git a/modules/ncmpcpp/default.nix b/modules/ncmpcpp/default.nix index 4301f542..12d535f7 100644 --- a/modules/ncmpcpp/default.nix +++ b/modules/ncmpcpp/default.nix @@ -1,65 +1,61 @@ { pkgs, ... }: let VARIABLES = import ../../src/variables.nix; in { - home-manager.sharedModules = [ - { - services.mpd = { - enable = true; - musicDirectory = "/home/${VARIABLES.username}/Music"; - }; + home.packages = with pkgs; [ mpc-cli ]; - xdg.configFile."mpd/mpd.conf".text = '' - auto_update "yes" - ''; + services.mpd = { + enable = true; + musicDirectory = "/home/${VARIABLES.username}/Music"; + }; - xdg.configFile."ncmpcpp/on-song-change.sh".source = ./on-song-change.sh; + xdg.configFile."mpd/mpd.conf".text = '' + auto_update "yes" + ''; - programs.ncmpcpp = { - enable = true; + xdg.configFile."ncmpcpp/on-song-change.sh".source = ./on-song-change.sh; - bindings = [ - { key = "mouse"; command = "dummy"; } - { key = "h"; command = [ "previous_column" "jump_to_parent_directory" ]; } - { key = "j"; command = "scroll_down"; } - { key = "k"; command = "scroll_up"; } - { key = "l"; command = [ "next_column" "enter_directory" "play_item" ]; } - { key = "H"; command = [ "select_item" "scroll_down" ]; } - { key = "J"; command = [ "move_sort_order_down" "move_selected_items_down" ]; } - { key = "K"; command = [ "move_sort_order_up" "move_selected_items_up" ]; } - { key = "L"; command = [ "select_item" "scroll_up" ]; } - { key = "'"; command = "remove_selection"; } - { key = "ctrl-u"; command = "page_up"; } - { key = "ctrl-d"; command = "page_down"; } - { key = "u"; command = "page_up"; } - { key = "d"; command = "page_down"; } - { key = "n"; command = "next_found_item"; } - { key = "N"; command = "previous_found_item"; } - { key = "t"; command = "next_screen"; } - { key = "g"; command = "move_home"; } - { key = "G"; command = "move_end"; } - { key = "w"; command = "next"; } - { key = "b"; command = "previous"; } - { key = ";"; command = "seek_forward"; } - { key = ","; command = "seek_backward"; } - { key = "f"; command = "apply_filter"; } - { key = "i"; command = "select_item"; } - { key = "x"; command = [ "delete_playlist_items" "delete_browser_items" "delete_stored_playlist" ]; } - { key = "U"; command = "update_database"; } - { key = "m"; command = "add_random_items"; } - ]; + programs.ncmpcpp = { + enable = true; - settings = { - ncmpcpp_directory = "~/.config/ncmpcpp"; - user_interface = "alternative"; - autocenter_mode = "yes"; - allow_for_physical_item_deletion = "no"; - mouse_support = "no"; - execute_on_song_change = "~/.config/ncmpcpp/on-song-change.sh"; - mpd_crossfade_time = 3; - }; - }; - } - ]; + bindings = [ + { key = "mouse"; command = "dummy"; } + { key = "h"; command = [ "previous_column" "jump_to_parent_directory" ]; } + { key = "j"; command = "scroll_down"; } + { key = "k"; command = "scroll_up"; } + { key = "l"; command = [ "next_column" "enter_directory" "play_item" ]; } + { key = "H"; command = [ "select_item" "scroll_down" ]; } + { key = "J"; command = [ "move_sort_order_down" "move_selected_items_down" ]; } + { key = "K"; command = [ "move_sort_order_up" "move_selected_items_up" ]; } + { key = "L"; command = [ "select_item" "scroll_up" ]; } + { key = "'"; command = "remove_selection"; } + { key = "ctrl-u"; command = "page_up"; } + { key = "ctrl-d"; command = "page_down"; } + { key = "u"; command = "page_up"; } + { key = "d"; command = "page_down"; } + { key = "n"; command = "next_found_item"; } + { key = "N"; command = "previous_found_item"; } + { key = "t"; command = "next_screen"; } + { key = "g"; command = "move_home"; } + { key = "G"; command = "move_end"; } + { key = "w"; command = "next"; } + { key = "b"; command = "previous"; } + { key = ";"; command = "seek_forward"; } + { key = ","; command = "seek_backward"; } + { key = "f"; command = "apply_filter"; } + { key = "i"; command = "select_item"; } + { key = "x"; command = [ "delete_playlist_items" "delete_browser_items" "delete_stored_playlist" ]; } + { key = "U"; command = "update_database"; } + { key = "m"; command = "add_random_items"; } + ]; - environment.systemPackages = with pkgs; [ mpc-cli ]; + settings = { + ncmpcpp_directory = "~/.config/ncmpcpp"; + user_interface = "alternative"; + autocenter_mode = "yes"; + allow_for_physical_item_deletion = "no"; + mouse_support = "no"; + execute_on_song_change = "~/.config/ncmpcpp/on-song-change.sh"; + mpd_crossfade_time = 3; + }; + }; } diff --git a/modules/qutebrowser/default.nix b/modules/qutebrowser/default.nix index 3c2883e6..c636908e 100644 --- a/modules/qutebrowser/default.nix +++ b/modules/qutebrowser/default.nix @@ -1,142 +1,138 @@ { pkgs, ... }: { - home-manager.sharedModules = [ - { - programs.qutebrowser = { - enable = true; - package = pkgs.qutebrowser-qt6; + programs.qutebrowser = { + enable = true; + package = pkgs.qutebrowser-qt6; - settings = { - confirm_quit = [ - "multiple-tabs" - "downloads" - ]; + settings = { + confirm_quit = [ + "multiple-tabs" + "downloads" + ]; - session.lazy_restore = true; + session.lazy_restore = true; - tabs = { - show = "multiple"; - mousewheel_switching = false; - last_close = "close"; - new_position.unrelated = "next"; - }; - - content = { - persistent_storage = true; - notifications.enabled = true; - register_protocol_handler = true; - mute = true; - headers.accept_language = "ja,en-US;q=0.9,en;q=0.8"; - }; - - fileselect = { - handler = "external"; - folder.command = [ "kitty" "-e" "joshuto" "--output-file" "{}" ]; - multiple_files.command = [ "kitty" "-e" "joshuto" "--output-file" "{}" ]; - single_file.command = [ "kitty" "-e" "joshuto" "--output-file" "{}" ]; - }; - - editor.command = [ "kitty" "-e" "nvim" "{}" ]; - }; - - keyBindings = { - normal = { - d = "scroll-page 0 0.5"; - u = "scroll-page 0 -0.5"; - D = "scroll-page 0 0.5"; - U = "scroll-page 0 -0.5"; - "" = "back"; - "" = "forward"; - "" = "tab-prev"; - "" = "tab-next"; - J = "tab-prev"; - K = "tab-next"; - "" = "devtools"; - zb = "bookmark-del"; - x = "tab-close"; - X = "undo"; - st = "config-cycle tabs.show multiple switching"; - sTh = "set tabs.position left"; - sTj = "set tabs.position bottom"; - sTk = "set tabs.position top"; - sTl = "set tabs.position right"; - }; - }; - - extraConfig = /* python */ '' - # Mute tabs by default - from qutebrowser.mainwindow import tabwidget - tabwidget.TabWidget.MUTE_STRING = "" - tabwidget.TabWidget.AUDIBLE_STRING = "[A]" - - # Better context menu colors - c.colors.contextmenu.disabled.fg = '#808080' - c.colors.contextmenu.menu.bg = '#353535' - c.colors.contextmenu.menu.fg = '#ffffff' - c.colors.contextmenu.selected.bg = '#909090' - - # Chromium flags - c.qt.args = ["disable-backing-store-limit", "enable-accelerated-video-decode", "disable-gpu-driver-bug-workarounds"] - c.qt.chromium.low_end_device_mode = 'never' - - # Download settings - c.downloads.location.directory = "$HOME/Downloads" - c.downloads.location.prompt = False - c.downloads.position = "bottom" - c.downloads.remove_finished = 5000 - - # Increase the default scroll offset of j/k - # NOTE: Unfortunately this breaks websites that use their own keybinds for j/k/etc - # config.bind('j', 'run-with-count 5 scroll down') - # config.bind('k', 'run-with-count 5 scroll up') - - # NOTE: Use with smooth scrolling enabled to scroll smoothly - # config.bind('d', 'run-with-count 12 scroll down') - # config.bind('u', 'run-with-count 12 scroll up') - - # Don't paste something by accident - config.unbind('pp', mode='normal') - config.unbind('pP', mode='normal') - config.unbind('Pp', mode='normal') - config.unbind('PP', mode='normal') - config.unbind('wp', mode='normal') - config.unbind('wP', mode='normal') - - # Easily enter account information - # NOTE: I re-evaluated pass when I was focusing on a terminal-centric workflow. - config.bind('zl', 'spawn --userscript qute-pass') - config.bind('zpl', 'spawn --userscript qute-pass --password-only') - config.bind('zol', 'spawn --userscript qute-pass --otp-only') - - # Hide the status bar except under exceptional circumstances - # NOTE: This broke more things than not, which is why I ultimately decided - # to always use the status bar. More information can be found in the - # following discussion: https://github.com/qutebrowser/qutebrowser/issues/2236 - # config.bind('o', 'set statusbar.show always;; set-cmd-text -s :open') - # config.bind('O', 'set statusbar.show always;; set-cmd-text -s :open -t') - # config.bind('T', 'set statusbar.show always;; set-cmd-text -sr :tab-focus') - # config.bind(':', 'set statusbar.show always;; set-cmd-text :') - # config.bind('/', 'set statusbar.show always;; set-cmd-text /') - # config.bind('', 'mode-enter normal;; set statusbar.show in-mode', mode='command') - config.bind('zM', 'spawn mpv --force-window=immediate {url}') - config.bind('zm', 'hint links spawn mpv --force-window=immediate {hint-url}') - - # Use proxy websites for popular services - config.bind('zu', 'hint links spawn -u untrack-url -O {hint-url}') - - # Don't automatically enter/leave insert mode - # NOTE: This was originally done to prevent insert mode from prematurely exiting - # in certain # cases (such as mouse usage), although keeping auto functionality - # seems to be more useful # long-term. - c.input.insert_mode.auto_enter = False - c.input.insert_mode.auto_leave = False - - c.url.start_pages = ['about:blank'] - c.url.default_page = "about:blank" - c.url.searchengines = { - 'DEFAULT': 'https://search.goo.ne.jp/web.jsp?MT={}' - } - ''; + tabs = { + show = "multiple"; + mousewheel_switching = false; + last_close = "close"; + new_position.unrelated = "next"; }; - } - ]; + + content = { + persistent_storage = true; + notifications.enabled = true; + register_protocol_handler = true; + mute = true; + headers.accept_language = "ja,en-US;q=0.9,en;q=0.8"; + }; + + fileselect = { + handler = "external"; + folder.command = [ "kitty" "-e" "joshuto" "--output-file" "{}" ]; + multiple_files.command = [ "kitty" "-e" "joshuto" "--output-file" "{}" ]; + single_file.command = [ "kitty" "-e" "joshuto" "--output-file" "{}" ]; + }; + + editor.command = [ "kitty" "-e" "nvim" "{}" ]; + }; + + keyBindings = { + normal = { + d = "scroll-page 0 0.5"; + u = "scroll-page 0 -0.5"; + D = "scroll-page 0 0.5"; + U = "scroll-page 0 -0.5"; + "" = "back"; + "" = "forward"; + "" = "tab-prev"; + "" = "tab-next"; + J = "tab-prev"; + K = "tab-next"; + "" = "devtools"; + zb = "bookmark-del"; + x = "tab-close"; + X = "undo"; + st = "config-cycle tabs.show multiple switching"; + sTh = "set tabs.position left"; + sTj = "set tabs.position bottom"; + sTk = "set tabs.position top"; + sTl = "set tabs.position right"; + }; + }; + + extraConfig = /* python */ '' + # Mute tabs by default + from qutebrowser.mainwindow import tabwidget + tabwidget.TabWidget.MUTE_STRING = "" + tabwidget.TabWidget.AUDIBLE_STRING = "[A]" + + # Better context menu colors + c.colors.contextmenu.disabled.fg = '#808080' + c.colors.contextmenu.menu.bg = '#353535' + c.colors.contextmenu.menu.fg = '#ffffff' + c.colors.contextmenu.selected.bg = '#909090' + + # Chromium flags + c.qt.args = ["disable-backing-store-limit", "enable-accelerated-video-decode", "disable-gpu-driver-bug-workarounds"] + c.qt.chromium.low_end_device_mode = 'never' + + # Download settings + c.downloads.location.directory = "$HOME/Downloads" + c.downloads.location.prompt = False + c.downloads.position = "bottom" + c.downloads.remove_finished = 5000 + + # Increase the default scroll offset of j/k + # NOTE: Unfortunately this breaks websites that use their own keybinds for j/k/etc + # config.bind('j', 'run-with-count 5 scroll down') + # config.bind('k', 'run-with-count 5 scroll up') + + # NOTE: Use with smooth scrolling enabled to scroll smoothly + # config.bind('d', 'run-with-count 12 scroll down') + # config.bind('u', 'run-with-count 12 scroll up') + + # Don't paste something by accident + config.unbind('pp', mode='normal') + config.unbind('pP', mode='normal') + config.unbind('Pp', mode='normal') + config.unbind('PP', mode='normal') + config.unbind('wp', mode='normal') + config.unbind('wP', mode='normal') + + # Easily enter account information + # NOTE: I re-evaluated pass when I was focusing on a terminal-centric workflow. + config.bind('zl', 'spawn --userscript qute-pass') + config.bind('zpl', 'spawn --userscript qute-pass --password-only') + config.bind('zol', 'spawn --userscript qute-pass --otp-only') + + # Hide the status bar except under exceptional circumstances + # NOTE: This broke more things than not, which is why I ultimately decided + # to always use the status bar. More information can be found in the + # following discussion: https://github.com/qutebrowser/qutebrowser/issues/2236 + # config.bind('o', 'set statusbar.show always;; set-cmd-text -s :open') + # config.bind('O', 'set statusbar.show always;; set-cmd-text -s :open -t') + # config.bind('T', 'set statusbar.show always;; set-cmd-text -sr :tab-focus') + # config.bind(':', 'set statusbar.show always;; set-cmd-text :') + # config.bind('/', 'set statusbar.show always;; set-cmd-text /') + # config.bind('', 'mode-enter normal;; set statusbar.show in-mode', mode='command') + config.bind('zM', 'spawn mpv --force-window=immediate {url}') + config.bind('zm', 'hint links spawn mpv --force-window=immediate {hint-url}') + + # Use proxy websites for popular services + config.bind('zu', 'hint links spawn -u untrack-url -O {hint-url}') + + # Don't automatically enter/leave insert mode + # NOTE: This was originally done to prevent insert mode from prematurely exiting + # in certain # cases (such as mouse usage), although keeping auto functionality + # seems to be more useful # long-term. + c.input.insert_mode.auto_enter = False + c.input.insert_mode.auto_leave = False + + c.url.start_pages = ['about:blank'] + c.url.default_page = "about:blank" + c.url.searchengines = { + 'DEFAULT': 'https://search.goo.ne.jp/web.jsp?MT={}' + } + ''; + }; } diff --git a/modules/rofi/default.nix b/modules/rofi/default.nix index fed86347..9487a882 100644 --- a/modules/rofi/default.nix +++ b/modules/rofi/default.nix @@ -1,28 +1,24 @@ { lib, ... }: { - home-manager.sharedModules = [ - { - programs.rofi = { - enable = true; - cycle = false; + programs.rofi = { + enable = true; + cycle = false; - extraConfig = { - modi = "drun,filebrowser"; - font = "Noto Sans CJK JP 12"; - show-icons = true; - bw = 0; - display-drun = ""; - display-window = ""; - display-combi = ""; - icon-theme = "Fluent-dark"; - terminal = "kitty"; - drun-match-fields = "name"; - drun-display-format = "{name}"; - me-select-entry = ""; - me-accept-entry = "MousePrimary"; - }; + extraConfig = { + modi = "drun,filebrowser"; + font = "Noto Sans CJK JP 12"; + show-icons = true; + bw = 0; + display-drun = ""; + display-window = ""; + display-combi = ""; + icon-theme = "Fluent-dark"; + terminal = "kitty"; + drun-match-fields = "name"; + drun-display-format = "{name}"; + me-select-entry = ""; + me-accept-entry = "MousePrimary"; + }; - theme = lib.mkForce ./launchpad.rasi; - }; - } - ]; + theme = lib.mkForce ./launchpad.rasi; + }; } diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix index d13c4341..4b1e8a7f 100644 --- a/modules/waybar/default.nix +++ b/modules/waybar/default.nix @@ -1,160 +1,154 @@ -{ lib -, ... -}: { - home-manager.sharedModules = [ - { - programs.waybar = { - enable = true; +{ lib, ... }: { + programs.waybar = { + enable = true; - settings = { - mainBar = { - layer = "top"; - position = "right"; - width = 45; - spacing = 8; + settings = { + mainBar = { + layer = "top"; + position = "right"; + width = 45; + spacing = 8; - modules-left = [ "wlr/workspaces" "custom/new-workspace" ]; - modules-right = [ "tray" "wireplumber" "backlight" "battery" "clock" ]; + modules-left = [ "wlr/workspaces" "custom/new-workspace" ]; + modules-right = [ "tray" "wireplumber" "backlight" "battery" "clock" ]; - tray = { - icon-size = 24; - spacing = 8; - }; + tray = { + icon-size = 24; + spacing = 8; + }; - "wlr/workspaces" = { - on-click = "activate"; - sort-by-number = true; - format = "{icon}"; - format-icons = { - "1" = "一"; - "2" = "二"; - "3" = "三"; - "4" = "四"; - "5" = "五"; - "6" = "六"; - "7" = "七"; - "8" = "八"; - "9" = "九"; - "10" = "十"; - }; - }; + "wlr/workspaces" = { + on-click = "activate"; + sort-by-number = true; + format = "{icon}"; + format-icons = { + "1" = "一"; + "2" = "二"; + "3" = "三"; + "4" = "四"; + "5" = "五"; + "6" = "六"; + "7" = "七"; + "8" = "八"; + "9" = "九"; + "10" = "十"; + }; + }; - wireplumber = { - format = "{icon}"; - tooltip-format = "{volume}% {node_name}"; - format-muted = ""; - format-icons = [ "" "" ]; - }; + wireplumber = { + format = "{icon}"; + tooltip-format = "{volume}% {node_name}"; + format-muted = ""; + format-icons = [ "" "" ]; + }; - battery = { - "format" = "{icon}"; - "tooltip-format" = "{capacity}% {timeTo}"; - "format-icons" = [ "" "" "" "" "" ]; - }; + battery = { + "format" = "{icon}"; + "tooltip-format" = "{capacity}% {timeTo}"; + "format-icons" = [ "" "" "" "" "" ]; + }; - clock = { - "format" = "{:%H\n%M}"; - "tooltip-format" = "{calendar}"; - "calendar" = { - "mode" = "month"; - "weeks-pos" = "right"; - "format" = { - "months" = "{}"; - "days" = "{}"; - "weeks" = "W{}"; - "weekdays" = "{}"; - "today" = "{}"; - }; - }; - }; - - backlight = { - "format" = "{icon}"; - "format-icons" = [ "" "" ]; - }; - - "custom/new-workspace" = { - "format" = "+"; - "on-click" = "hyprctl dispatch workspace empty && sleep 0.1 && rofi -show drun"; - "on-click-right" = "sleep 0.1 && rofi -show drun"; - "on-click-middle" = "hyprctl dispatch workspace empty"; - "tooltip" = false; + clock = { + "format" = "{:%H\n%M}"; + "tooltip-format" = "{calendar}"; + "calendar" = { + "mode" = "month"; + "weeks-pos" = "right"; + "format" = { + "months" = "{}"; + "days" = "{}"; + "weeks" = "W{}"; + "weekdays" = "{}"; + "today" = "{}"; }; }; }; - style = lib.mkForce /* css */ '' - @define-color base00 #272822; - @define-color base01 #383830; - @define-color base02 #49483e; - @define-color base03 #75715e; - @define-color base04 #a59f85; - @define-color base05 #f8f8f2; - @define-color base06 #f5f4f1; - @define-color base07 #f9f8f5; - @define-color base08 #f92672; - @define-color base09 #fd971f; - @define-color base0A #f4bf75; - @define-color base0B #a6e22e; - @define-color base0C #a1efe4; - @define-color base0D #66d9ef; - @define-color base0E #ae81ff; - @define-color base0F #cc6633; + backlight = { + "format" = "{icon}"; + "format-icons" = [ "" "" ]; + }; - * { - color: @base05; - font-size: 16px; - } - - window#waybar { - background: alpha(@base00, 0.92); - border-left: 1px solid alpha(@base02, 0.67); - } - - #workspaces button { - padding: 12px 0; - border-radius: 0; - border-bottom: 1px solid alpha(@base02, 0.5); - } - - #workspaces button:hover { - background: inherit; - } - - #workspaces button.active { - background: alpha(@base02, 0.5); - } - - #window { - padding-top: 8px; - padding-bottom: 12px; - } - - tooltip, #tray menu { - background: @base00; - border: 1px solid alpha(@base09, 0.93); - padding: 8px; - } - - #backlight, #battery, #wireplumber { - font-family: "Font Awesome 6 Free Solid"; - font-size: 24px; - } - - #custom-new-workspace { - font-family: "Font Awesome 6 Free Solid"; - padding-top: 8px; - padding-bottom: 8px; - color: alpha(@base0A, 0.67); - } - - #clock { - font-size: 18px; - font-weight: bold; - padding-bottom: 8px; - } - ''; + "custom/new-workspace" = { + "format" = "+"; + "on-click" = "hyprctl dispatch workspace empty && sleep 0.1 && rofi -show drun"; + "on-click-right" = "sleep 0.1 && rofi -show drun"; + "on-click-middle" = "hyprctl dispatch workspace empty"; + "tooltip" = false; + }; }; - } - ]; + }; + + style = lib.mkForce /* css */ '' + @define-color base00 #272822; + @define-color base01 #383830; + @define-color base02 #49483e; + @define-color base03 #75715e; + @define-color base04 #a59f85; + @define-color base05 #f8f8f2; + @define-color base06 #f5f4f1; + @define-color base07 #f9f8f5; + @define-color base08 #f92672; + @define-color base09 #fd971f; + @define-color base0A #f4bf75; + @define-color base0B #a6e22e; + @define-color base0C #a1efe4; + @define-color base0D #66d9ef; + @define-color base0E #ae81ff; + @define-color base0F #cc6633; + + * { + color: @base05; + font-size: 16px; + } + + window#waybar { + background: alpha(@base00, 0.92); + border-left: 1px solid alpha(@base02, 0.67); + } + + #workspaces button { + padding: 12px 0; + border-radius: 0; + border-bottom: 1px solid alpha(@base02, 0.5); + } + + #workspaces button:hover { + background: inherit; + } + + #workspaces button.active { + background: alpha(@base02, 0.5); + } + + #window { + padding-top: 8px; + padding-bottom: 12px; + } + + tooltip, #tray menu { + background: @base00; + border: 1px solid alpha(@base09, 0.93); + padding: 8px; + } + + #backlight, #battery, #wireplumber { + font-family: "Font Awesome 6 Free Solid"; + font-size: 24px; + } + + #custom-new-workspace { + font-family: "Font Awesome 6 Free Solid"; + padding-top: 8px; + padding-bottom: 8px; + color: alpha(@base0A, 0.67); + } + + #clock { + font-size: 18px; + font-weight: bold; + padding-bottom: 8px; + } + ''; + }; } diff --git a/modules/zathura/default.nix b/modules/zathura/default.nix index 2776b4d6..66e74ba1 100644 --- a/modules/zathura/default.nix +++ b/modules/zathura/default.nix @@ -1,17 +1,13 @@ { - home-manager.sharedModules = [ - { - programs.zathura = { - enable = true; + programs.zathura = { + enable = true; - options = { - guioptions = "v"; - adjust-open = "width"; - statusbar-basename = true; - render-loading = false; - scroll-step = 120; - }; - }; - } - ]; + options = { + guioptions = "v"; + adjust-open = "width"; + statusbar-basename = true; + render-loading = false; + scroll-step = 120; + }; + }; }