dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
modules/desktop/_wm/files.nix (3910B)
1## File Manager
2{
3 util ? null,
4 files ? null,
5 inputs ? null,
6 ...
7}: {
8 nixos = {pkgs, ...}: {
9 services.dbus.packages = [pkgs.nemo-with-extensions];
10 environment.systemPackages = with pkgs; [
11 nemo-with-extensions
12 cinnamon-desktop
13 bulky
14 file-roller
15 (lxqt.pcmanfm-qt.overrideAttrs (old: {
16 postPatch =
17 (old.postPatch or "")
18 + ''
19 substituteInPlace pcmanfm/application.cpp \
20 --replace-fail 'dbus.interface()->registerService(fileManagerService, QDBusConnectionInterface::QueueService);' ""
21 '';
22 }))
23 ];
24 };
25
26 home = {
27 config,
28 pkgs,
29 ...
30 }: let
31 inherit (pkgs.lib) getExe getExe' replaceStrings;
32 inherit (inputs.home-manager.lib) hm;
33 terminal = "kitty";
34 in {
35 xdg.mimeApps.defaultApplications = util.build.mime {
36 archive = ["org.gnome.FileRoller.desktop"];
37 directory = ["nemo.desktop"];
38 };
39
40 # Prefer Nemo
41 xdg.dataFile."dbus-1/services/org.freedesktop.FileManager1.service".source = "${pkgs.nemo-with-extensions}/share/dbus-1/services/nemo.FileManager1.service";
42
43 # Settings
44 dconf.settings = {
45 "org/gtk/gtk4/settings/file-chooser".sort-directories-first = true;
46 "org/nemo/search".search-reverse-sort = false;
47 "org/nemo/desktop".show-desktop-icons = false;
48 "org/nemo/plugins".disabled-actions = ["change-background.nemo_action"];
49 "org/nemo/icon-view".captions = [
50 "size"
51 "type"
52 "date_modified"
53 ];
54
55 "org/nemo/preferences" = {
56 click-policy = "double";
57 date-format = "informal";
58 inherit-folder-viewer = true;
59 quick-renames-with-pause-in-between = true;
60 show-advanced-permissions = true;
61 show-new-folder-icon-toolbar = false;
62 show-show-thumbnails-toolbar = true;
63 tooltips-in-icon-view = true;
64 tooltips-in-list-view = false;
65 tooltips-show-access-date = true;
66 tooltips-show-birth-date = true;
67 tooltips-show-file-type = true;
68 tooltips-show-mod-date = true;
69 };
70
71 "org/nemo/preferences/menu-config" = {
72 background-menu-open-in-terminal = false;
73 selection-menu-open-in-terminal = false;
74 };
75 };
76
77 home = {
78 persist.directories = [
79 ".config/nemo"
80 ".local/share/nemo"
81 ".config/pcmanfm-qt"
82 ];
83
84 # Bulk Renamer
85 activation.nemo-rename = hm.dag.entryAfter ["writeBoundary"] ''
86 if [[ -v DBUS_SESSION_BUS_ADDRESS ]]
87 then
88 export DCONF_DBUS_RUN_SESSION=""
89 else
90 export DCONF_DBUS_RUN_SESSION="${getExe' pkgs.dbus "dbus-run-session"} --dbus-daemon=${getExe' pkgs.dbus "dbus-daemon"}"
91 fi
92
93 run $DCONF_DBUS_RUN_SESSION ${getExe pkgs.dconf} write /org/nemo/preferences/bulk-rename-tool "b'bulky'"
94 unset DCONF_DBUS_RUN_SESSION
95 '';
96
97 file = {
98 # Open in Terminal
99 ".local/share/nemo/actions/terminal.nemo_action".text = ''
100 [Nemo Action]
101 Name=Open in Terminal
102 Comment=Opens ${terminal} in the selected folder
103 Exec=${terminal} --working-directory=%F
104 Icon-Name=${terminal}
105 Selection=any
106 Extensions=dir;
107 EscapeSpaces=true
108 '';
109
110 # Desktop Icons
111 ".config/pcmanfm-qt/default/settings.conf".text =
112 replaceStrings
113 [
114 "@icon"
115 "@font"
116 "@terminal"
117 "@wallpaper"
118 "@archiver"
119 ]
120 [
121 (
122 if config.stylix.icons.dark != null
123 then config.stylix.icons.dark
124 else "default"
125 )
126 config.stylix.fonts.sansSerif.name
127 terminal
128 (toString files.images.transparent)
129 "file-roller"
130 ]
131 files.pcmanfm;
132 };
133 };
134 };
135}