feat(mc): add midnight commander with declarative config
Public baseline module: installs `mc` plus `ouch` (backs the F2 pack/unpack entries, archive format inferred from the extension), and ships `ini`, `menu`, and a generated `panels.ini` into `$XDG_CONFIG_HOME/mc`. `local.mc.otherDir` exposes the other-panel start dir as an option defaulting to `config.home.homeDirectory`, so the one personal value isn't baked in. The F2 user menu is trimmed to the entries that match this config (imv/zathura/mpv openers, ouch pack/unpack, man view); the stock rcp/uudecode/news/latex cruft is dropped. `auto_save_setup=false` keeps mc from rewriting the read-only store symlinks on exit.
This commit is contained in:
@@ -0,0 +1,160 @@
|
|||||||
|
[Midnight-Commander]
|
||||||
|
verbose=true
|
||||||
|
shell_patterns=true
|
||||||
|
auto_save_setup=false
|
||||||
|
preallocate_space=false
|
||||||
|
auto_menu=false
|
||||||
|
use_internal_view=true
|
||||||
|
use_internal_edit=false
|
||||||
|
clear_before_exec=true
|
||||||
|
confirm_delete=true
|
||||||
|
confirm_overwrite=true
|
||||||
|
confirm_execute=false
|
||||||
|
confirm_history_cleanup=true
|
||||||
|
confirm_exit=false
|
||||||
|
confirm_directory_hotlist_delete=false
|
||||||
|
confirm_view_dir=false
|
||||||
|
safe_delete=false
|
||||||
|
safe_overwrite=false
|
||||||
|
use_8th_bit_as_meta=false
|
||||||
|
mouse_move_pages_viewer=true
|
||||||
|
mouse_close_dialog=false
|
||||||
|
fast_refresh=false
|
||||||
|
drop_menus=false
|
||||||
|
wrap_mode=false
|
||||||
|
old_esc_mode=true
|
||||||
|
cd_symlinks=true
|
||||||
|
show_all_if_ambiguous=true
|
||||||
|
use_file_to_guess_type=true
|
||||||
|
alternate_plus_minus=false
|
||||||
|
only_leading_plus_minus=true
|
||||||
|
show_output_starts_shell=false
|
||||||
|
xtree_mode=false
|
||||||
|
file_op_compute_totals=true
|
||||||
|
classic_progressbar=true
|
||||||
|
use_netrc=true
|
||||||
|
ftpfs_always_use_proxy=false
|
||||||
|
ftpfs_use_passive_connections=true
|
||||||
|
ftpfs_use_passive_connections_over_proxy=false
|
||||||
|
ftpfs_use_unix_list_options=true
|
||||||
|
ftpfs_first_cd_then_ls=true
|
||||||
|
ignore_ftp_chattr_errors=true
|
||||||
|
editor_fill_tabs_with_spaces=false
|
||||||
|
editor_return_does_auto_indent=true
|
||||||
|
editor_backspace_through_tabs=false
|
||||||
|
editor_fake_half_tabs=true
|
||||||
|
editor_option_save_position=true
|
||||||
|
editor_option_auto_para_formatting=false
|
||||||
|
editor_option_typewriter_wrap=false
|
||||||
|
editor_edit_confirm_save=true
|
||||||
|
editor_syntax_highlighting=true
|
||||||
|
editor_persistent_selections=true
|
||||||
|
editor_drop_selection_on_copy=true
|
||||||
|
editor_cursor_beyond_eol=false
|
||||||
|
editor_cursor_after_inserted_block=false
|
||||||
|
editor_visible_tabs=true
|
||||||
|
editor_visible_spaces=true
|
||||||
|
editor_line_state=false
|
||||||
|
editor_simple_statusbar=false
|
||||||
|
editor_check_new_line=false
|
||||||
|
editor_show_right_margin=false
|
||||||
|
editor_group_undo=false
|
||||||
|
editor_state_full_filename=false
|
||||||
|
editor_ask_filename_before_edit=false
|
||||||
|
nice_rotating_dash=true
|
||||||
|
mcview_remember_file_position=false
|
||||||
|
auto_fill_mkdir_name=true
|
||||||
|
copymove_persistent_attr=true
|
||||||
|
pause_after_run=1
|
||||||
|
mouse_repeat_rate=100
|
||||||
|
double_click_speed=250
|
||||||
|
old_esc_mode_timeout=1000000
|
||||||
|
max_dirt_limit=10
|
||||||
|
num_history_items_recorded=60
|
||||||
|
vfs_timeout=60
|
||||||
|
ftpfs_directory_timeout=900
|
||||||
|
ftpfs_retry_seconds=30
|
||||||
|
fish_directory_timeout=900
|
||||||
|
editor_tab_spacing=8
|
||||||
|
editor_word_wrap_line_length=72
|
||||||
|
editor_option_save_mode=0
|
||||||
|
editor_backup_extension=~
|
||||||
|
editor_filesize_threshold=64M
|
||||||
|
editor_stop_format_chars=-+*\\,.;:&>
|
||||||
|
mcview_eof=
|
||||||
|
skin=yadt256-defbg
|
||||||
|
|
||||||
|
shadows=true
|
||||||
|
|
||||||
|
[Layout]
|
||||||
|
output_lines=0
|
||||||
|
left_panel_size=115
|
||||||
|
top_panel_size=0
|
||||||
|
message_visible=true
|
||||||
|
keybar_visible=true
|
||||||
|
xterm_title=true
|
||||||
|
command_prompt=true
|
||||||
|
menubar_visible=true
|
||||||
|
free_space=true
|
||||||
|
horizontal_split=false
|
||||||
|
vertical_equal=true
|
||||||
|
horizontal_equal=true
|
||||||
|
|
||||||
|
[Misc]
|
||||||
|
timeformat_recent=%d. %b %H:%M
|
||||||
|
timeformat_old=%d. %b %Y
|
||||||
|
ftp_proxy_host=gate
|
||||||
|
ftpfs_password=anonymous@
|
||||||
|
display_codepage=UTF-8
|
||||||
|
source_codepage=Other_8_bit
|
||||||
|
autodetect_codeset=
|
||||||
|
clipboard_store=
|
||||||
|
clipboard_paste=
|
||||||
|
|
||||||
|
[Colors]
|
||||||
|
base_color=
|
||||||
|
st-256color=
|
||||||
|
color_terminals=
|
||||||
|
|
||||||
|
[Panels]
|
||||||
|
show_mini_info=true
|
||||||
|
kilobyte_si=true
|
||||||
|
mix_all_files=false
|
||||||
|
show_backups=true
|
||||||
|
show_dot_files=true
|
||||||
|
fast_reload=false
|
||||||
|
fast_reload_msg_shown=false
|
||||||
|
mark_moves_down=true
|
||||||
|
reverse_files_only=true
|
||||||
|
auto_save_setup_panels=false
|
||||||
|
navigate_with_arrows=true
|
||||||
|
panel_scroll_pages=true
|
||||||
|
panel_scroll_center=false
|
||||||
|
mouse_move_pages=true
|
||||||
|
filetype_mode=true
|
||||||
|
permission_mode=false
|
||||||
|
torben_fj_mode=false
|
||||||
|
quick_search_mode=2
|
||||||
|
select_flags=6
|
||||||
|
|
||||||
|
simple_swap=false
|
||||||
|
|
||||||
|
[FindFile]
|
||||||
|
file_case_sens=true
|
||||||
|
file_shell_pattern=true
|
||||||
|
file_find_recurs=true
|
||||||
|
file_skip_hidden=false
|
||||||
|
file_all_charsets=false
|
||||||
|
content_case_sens=true
|
||||||
|
content_regexp=false
|
||||||
|
content_first_hit=false
|
||||||
|
content_whole_words=false
|
||||||
|
content_all_charsets=false
|
||||||
|
ignore_dirs_enable=true
|
||||||
|
ignore_dirs=
|
||||||
|
|
||||||
|
[Panelize]
|
||||||
|
Geänderte Git-Dateien=git ls-files --modified
|
||||||
|
Nach dem Patchen nach Ablehnungen suchen=find . -name \\*.rej -print
|
||||||
|
Suche SUID- und SGID-Programme=find . \\( \\( -perm -04000 -a -perm /011 \\) -o \\( -perm -02000 -a -perm /01 \\) \\) -print
|
||||||
|
Suche nach *.orig nach dem Patchen=find . -name \\*.orig -print
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
shell_patterns=0
|
||||||
|
|
||||||
|
# F2 user menu. Format macros: %f current file · %d current dir · %s tagged
|
||||||
|
# files else current · %t tagged files · %D other panel's dir. Full list: mc(1).
|
||||||
|
|
||||||
|
c Pack selected into an archive (ouch — format from the name's extension)
|
||||||
|
NAME=%{Archive name, e.g. stuff.tar.zst}
|
||||||
|
ouch compress %s "$NAME"
|
||||||
|
|
||||||
|
x Unpack archive here (ouch)
|
||||||
|
ouch decompress %f
|
||||||
|
|
||||||
|
i Open file with image viewer (imv)
|
||||||
|
imv %f
|
||||||
|
|
||||||
|
I Open current directory with image viewer (imv)
|
||||||
|
imv %d
|
||||||
|
|
||||||
|
p Open file with document viewer (zathura)
|
||||||
|
zathura %f
|
||||||
|
|
||||||
|
v Play file with mpv
|
||||||
|
mpv %f
|
||||||
|
|
||||||
|
V Play current directory with mpv
|
||||||
|
mpv %d
|
||||||
|
|
||||||
|
m View a man page
|
||||||
|
MAN=%{Enter manual name}
|
||||||
|
%view{ascii,nroff} MANROFFOPT='-c -Tlatin1' MAN_KEEP_FORMATTING=1 man -P cat "$MAN"
|
||||||
+1
-1
@@ -71,7 +71,7 @@ let
|
|||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ];
|
imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ./mc.nix ];
|
||||||
|
|
||||||
# Put ~/.local/bin (the XDG user-bin dir) on PATH so hand-dropped scripts run
|
# Put ~/.local/bin (the XDG user-bin dir) on PATH so hand-dropped scripts run
|
||||||
# by name without wiring each through nix.
|
# by name without wiring each through nix.
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
# Midnight Commander: TUI file manager. Its config (ini, panels, F2 user menu)
|
||||||
|
# is opinionated but generic, so it lives in the public baseline alongside the
|
||||||
|
# other desktop tooling. The only personal value is the right-panel start dir,
|
||||||
|
# exposed as an option defaulting to the consumer's own home.
|
||||||
|
#
|
||||||
|
# ouch backs the F2 pack/unpack entries (one tool, archive format inferred from
|
||||||
|
# the extension), so it ships with mc to keep the menu self-contained.
|
||||||
|
#
|
||||||
|
# mc honours XDG natively: config in $XDG_CONFIG_HOME/mc (the files below),
|
||||||
|
# mutable runtime state (history, cursor positions) in $XDG_DATA_HOME/mc — no
|
||||||
|
# env vars needed. `ini` sets auto_save_setup=false so mc never rewrites these
|
||||||
|
# read-only store symlinks on exit.
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.local.mc.otherDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = config.home.homeDirectory;
|
||||||
|
defaultText = lib.literalExpression "config.home.homeDirectory";
|
||||||
|
description = "Startup directory for mc's other (right) panel.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
home.packages = [ pkgs.mc pkgs.ouch ];
|
||||||
|
|
||||||
|
xdg.configFile = {
|
||||||
|
"mc/ini".source = ./assets/mc/ini;
|
||||||
|
"mc/menu".source = ./assets/mc/menu;
|
||||||
|
|
||||||
|
# Generated (not a static asset) so other_dir tracks the option instead of
|
||||||
|
# baking in a personal path.
|
||||||
|
"mc/panels.ini".text = ''
|
||||||
|
[New Left Panel]
|
||||||
|
display=listing
|
||||||
|
reverse=false
|
||||||
|
case_sensitive=true
|
||||||
|
exec_first=false
|
||||||
|
sort_order=name
|
||||||
|
list_mode=full
|
||||||
|
brief_cols=2
|
||||||
|
user_format=half type name | size | perm | mtime
|
||||||
|
user_status0=half type name | size | perm
|
||||||
|
user_status1=half type name | size | perm
|
||||||
|
user_status2=half type name | size | perm
|
||||||
|
user_status3=half type name | owner | group | ctime
|
||||||
|
user_mini_status=true
|
||||||
|
list_format=user
|
||||||
|
|
||||||
|
[New Right Panel]
|
||||||
|
display=listing
|
||||||
|
reverse=false
|
||||||
|
case_sensitive=true
|
||||||
|
exec_first=false
|
||||||
|
sort_order=name
|
||||||
|
list_mode=full
|
||||||
|
brief_cols=2
|
||||||
|
user_format=half type name | size | perm | mtime
|
||||||
|
user_status0=half type name | size | perm
|
||||||
|
user_status1=half type name | size | perm
|
||||||
|
user_status2=half type name | size | perm
|
||||||
|
user_status3=half type name | owner | group | ctime
|
||||||
|
user_mini_status=true
|
||||||
|
list_format=user
|
||||||
|
|
||||||
|
[Dirs]
|
||||||
|
current_is_left=true
|
||||||
|
other_dir=${config.local.mc.otherDir}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user