dotfiles

My PC Dotfiles & Website
commit e386aa3775cd98a90b8ca1e29fb338ab56319fbe
parent 2ace6292c979d524ea248fb4b8dd573834344284
Author: maydayv7 <maydayv7@gmail.com>
Date:   Mon, 15 Jan 2024 11:38:59 +0530

feat: Use ULauncher

Also add `lib.map.folder`

Diffstat:

Mfiles/README.md | 1+
Mfiles/flake.nix | 12++++++++++++
Afiles/ulauncher/extensions/com.github.brpaz.ulauncher-currency.db | 0
Afiles/ulauncher/extensions/com.github.brpaz.ulauncher-file-search.db | 0
Afiles/ulauncher/extensions/com.github.fajtak.ulauncher-weather.db | 0
Afiles/ulauncher/extensions/com.github.frdrk.ulauncher-dead-simple-convert.db | 0
Afiles/ulauncher/extensions/com.github.iboyperson.ulauncher-system.db | 0
Afiles/ulauncher/extensions/com.github.ikorjefocur.ulauncher-commandrunner.db | 0
Afiles/ulauncher/extensions/com.github.isacikgoz.ukill.db | 0
Afiles/ulauncher/extensions/com.github.melianmiko.ulauncher-nmcli.db | 0
Afiles/ulauncher/extensions/com.github.nastuzzisamy.ulauncher-custom-scripts.db | 0
Afiles/ulauncher/extensions/com.github.tevenfeng.ulauncher-dc.db | 0
Afiles/ulauncher/extensions/com.github.ulauncher.ulauncher-emoji.db | 0
Afiles/ulauncher/extensions/com.github.ulauncher.ulauncher-timer.db | 0
Afiles/ulauncher/settings/extension.json | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afiles/ulauncher/settings/scripts.json | 8++++++++
Afiles/ulauncher/settings/settings.json | 11+++++++++++
Afiles/ulauncher/themes/adwaita/manifest.json | 12++++++++++++
Afiles/ulauncher/themes/adwaita/theme-gtk-3.20.css | 10++++++++++
Afiles/ulauncher/themes/adwaita/theme.css | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afiles/ulauncher/themes/arc/manifest.json | 12++++++++++++
Afiles/ulauncher/themes/arc/theme-gtk-3.20.css | 10++++++++++
Afiles/ulauncher/themes/arc/theme.css | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mfiles/xfce/settings/xfce4-keyboard-shortcuts.xml | 1+
Mlib/README.md | 1+
Mlib/map.nix | 20++++++++++++++++++++
Mmodules/gui/default.nix | 18++++++++++++++----
Mmodules/gui/desktop/xfce.nix | 73++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mmodules/gui/wayland.nix | 10++--------
29 files changed, 423 insertions(+), 39 deletions(-)

diff --git a/files/README.md b/files/README.md @@ -18,6 +18,7 @@ The `files` directory is used to store all my plain-text program configuration f - [`repl.nix`](./repl.nix): Interactive Nix Shell to explore syntax and configuration - [`templates`](./templates) - Document Templates - [`touchegg`](./touchegg) - Touchegg X11 Touchpad Gestures +- [`ulauncher`](./ulauncher) - ULauncher Application Launcher - [`vscode`](./vscode) - Visual Studio Code Editor Configuration - [`wine`](./wine) - Configuration and Theming for `wine` applications - [`xdg`](./xdg) - XDG Desktop Utilities Configuration diff --git a/files/flake.nix b/files/flake.nix @@ -97,6 +97,18 @@ # Document Templates templates = ./templates; + # ULauncher Application Launcher + ulauncher = + map.files { + directory = ./ulauncher/settings; + apply = readFile; + extension = ".json"; + } + // { + themes = ./ulauncher/themes; + extensions = ./ulauncher/extensions; + }; + # Visual Studio Code Editor vscode = map.files { directory = ./vscode; diff --git a/files/ulauncher/extensions/com.github.brpaz.ulauncher-currency.db b/files/ulauncher/extensions/com.github.brpaz.ulauncher-currency.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.brpaz.ulauncher-file-search.db b/files/ulauncher/extensions/com.github.brpaz.ulauncher-file-search.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.fajtak.ulauncher-weather.db b/files/ulauncher/extensions/com.github.fajtak.ulauncher-weather.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.frdrk.ulauncher-dead-simple-convert.db b/files/ulauncher/extensions/com.github.frdrk.ulauncher-dead-simple-convert.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.iboyperson.ulauncher-system.db b/files/ulauncher/extensions/com.github.iboyperson.ulauncher-system.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.ikorjefocur.ulauncher-commandrunner.db b/files/ulauncher/extensions/com.github.ikorjefocur.ulauncher-commandrunner.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.isacikgoz.ukill.db b/files/ulauncher/extensions/com.github.isacikgoz.ukill.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.melianmiko.ulauncher-nmcli.db b/files/ulauncher/extensions/com.github.melianmiko.ulauncher-nmcli.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.nastuzzisamy.ulauncher-custom-scripts.db b/files/ulauncher/extensions/com.github.nastuzzisamy.ulauncher-custom-scripts.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.tevenfeng.ulauncher-dc.db b/files/ulauncher/extensions/com.github.tevenfeng.ulauncher-dc.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.ulauncher.ulauncher-emoji.db b/files/ulauncher/extensions/com.github.ulauncher.ulauncher-emoji.db Binary files differ. diff --git a/files/ulauncher/extensions/com.github.ulauncher.ulauncher-timer.db b/files/ulauncher/extensions/com.github.ulauncher.ulauncher-timer.db Binary files differ. diff --git a/files/ulauncher/settings/extension.json b/files/ulauncher/settings/extension.json @@ -0,0 +1,86 @@ +{ + "com.github.ulauncher.ulauncher-emoji": { + "id": "com.github.ulauncher.ulauncher-emoji", + "url": "https://github.com/Ulauncher/ulauncher-emoji", + "updated_at": "2024-01-14T19:38:55.565827", + "last_commit": "827cfe5e1d2f89f742f811f981759787b0654fa9", + "last_commit_time": "2023-11-04T18:37:13" + }, + "com.github.brpaz.ulauncher-file-search": { + "id": "com.github.brpaz.ulauncher-file-search", + "url": "https://github.com/brpaz/ulauncher-file-search", + "updated_at": "2024-01-14T19:39:37.412020", + "last_commit": "0ea61c2049b27f1ddfa81d1844876f21dd9d6e7b", + "last_commit_time": "2020-07-03T13:30:16" + }, + "com.github.iboyperson.ulauncher-system": { + "id": "com.github.iboyperson.ulauncher-system", + "url": "https://github.com/iboyperson/ulauncher-system", + "updated_at": "2024-01-14T19:40:03.269429", + "last_commit": "7dedd992709fa2297735cddf852404144d4da47c", + "last_commit_time": "2023-11-14T16:53:20" + }, + "com.github.ulauncher.ulauncher-timer": { + "id": "com.github.ulauncher.ulauncher-timer", + "url": "https://github.com/ulauncher/ulauncher-timer", + "updated_at": "2024-01-14T19:40:27.342707", + "last_commit": "2d3fe82fe1e38670e6eb8887cd2a4b4d1c2baa79", + "last_commit_time": "2023-03-25T08:07:41" + }, + "com.github.nastuzzisamy.ulauncher-custom-scripts": { + "id": "com.github.nastuzzisamy.ulauncher-custom-scripts", + "url": "https://github.com/NastuzziSamy/ulauncher-custom-scripts", + "updated_at": "2024-01-14T19:40:48.262263", + "last_commit": "7a68cbafb4acc01fed340d0d2ae99a6701724b31", + "last_commit_time": "2022-11-21T21:19:31" + }, + "com.github.ikorjefocur.ulauncher-commandrunner": { + "id": "com.github.ikorjefocur.ulauncher-commandrunner", + "url": "https://github.com/IkorJefocur/ulauncher-commandrunner", + "updated_at": "2024-01-14T19:58:09.331459", + "last_commit": "c306301468cbaba23625bf0ef0639b7ad6602783", + "last_commit_time": "2022-03-01T19:34:35" + }, + "com.github.melianmiko.ulauncher-nmcli": { + "id": "com.github.melianmiko.ulauncher-nmcli", + "url": "https://github.com/melianmiko/ulauncher-nmcli", + "updated_at": "2024-01-15T11:00:03.423007", + "last_commit": "fe967c947748616df602c9d022fec6d68a6b2cf2", + "last_commit_time": "2022-05-01T12:20:38" + }, + "com.github.tevenfeng.ulauncher-dc": { + "id": "com.github.tevenfeng.ulauncher-dc", + "url": "https://github.com/tevenfeng/ulauncher-dc", + "updated_at": "2024-01-15T11:00:14.588647", + "last_commit": "4cdeb58b1f79b64f2f6e3b4eecc3a38b81c886ea", + "last_commit_time": "2022-06-16T09:10:28" + }, + "com.github.fajtak.ulauncher-weather": { + "id": "com.github.fajtak.ulauncher-weather", + "url": "https://github.com/fajtak/ulauncher-weather", + "updated_at": "2024-01-15T11:03:08.154706", + "last_commit": "996da704e505776753f6340755d20f03075c2be8", + "last_commit_time": "2022-04-05T18:23:30" + }, + "com.github.isacikgoz.ukill": { + "id": "com.github.isacikgoz.ukill", + "url": "https://github.com/isacikgoz/ukill", + "updated_at": "2024-01-15T11:07:55.208352", + "last_commit": "bc50d9f41d46b6813a5aeebddd15734dcdb9d8db", + "last_commit_time": "2019-05-28T18:30:00" + }, + "com.github.frdrk.ulauncher-dead-simple-convert": { + "id": "com.github.frdrk.ulauncher-dead-simple-convert", + "url": "https://github.com/frdrk/ulauncher-dead-simple-convert", + "updated_at": "2024-01-15T11:29:28.766027", + "last_commit": "c0821e83b6c1d5a4984ef72c82e54eb21d0149ac", + "last_commit_time": "2023-10-03T11:40:03" + }, + "com.github.brpaz.ulauncher-currency": { + "id": "com.github.brpaz.ulauncher-currency", + "url": "https://github.com/brpaz/ulauncher-currency", + "updated_at": "2024-01-15T11:29:58.066495", + "last_commit": "262ed206057d38cec97e94297ab94246a43468cd", + "last_commit_time": "2021-12-12T15:45:10" + } +} diff --git a/files/ulauncher/settings/scripts.json b/files/ulauncher/settings/scripts.json @@ -0,0 +1,8 @@ +[ + { + "name": "Documentation", + "description": "ULauncher Documentation", + "icon": "help-about", + "script": "xdg-open https://ulauncher.io/" + } +] diff --git a/files/ulauncher/settings/settings.json b/files/ulauncher/settings/settings.json @@ -0,0 +1,11 @@ +{ + "clear-previous-query": true, + "disable-desktop-filters": false, + "grab-mouse-pointer": false, + "hotkey-show-app": "<Super>slash", + "render-on-screen": "mouse-pointer-monitor", + "show-indicator-icon": false, + "show-recent-apps": "5", + "terminal-command": "@terminal", + "theme-name": "@theme" +} diff --git a/files/ulauncher/themes/adwaita/manifest.json b/files/ulauncher/themes/adwaita/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": "1", + "name": "adwaita-dark", + "display_name": "Adwaita Dark", + "extend_theme": "dark", + "css_file": "theme.css", + "css_file_gtk_3.20+": "theme-gtk-3.20.css", + "matched_text_hl_colors": { + "when_selected": "#99ccff", + "when_not_selected": "#99ccff" + } +} diff --git a/files/ulauncher/themes/adwaita/theme-gtk-3.20.css b/files/ulauncher/themes/adwaita/theme-gtk-3.20.css @@ -0,0 +1,10 @@ +@import url("theme.css"); + +.input { + caret-color: @caret_color; +} + +/* Workaround for GTK+ < 3.20 */ +.selected.item-box { + border: none; +} diff --git a/files/ulauncher/themes/adwaita/theme.css b/files/ulauncher/themes/adwaita/theme.css @@ -0,0 +1,98 @@ +/* App Window */ +@define-color bg_color #242424; +@define-color window_bg @bg_color; +@define-color window_border_color #3A3A3A; +@define-color prefs_backgroud #454545; + +/* Input */ +@define-color selected_bg_color #4675ab; +@define-color selected_fg_color #d5eaff; +@define-color input_color #ddd; +@define-color caret_color darker(@input_color); + +/* Result Items */ +@define-color item_name #ffffff; +@define-color item_text #999; +@define-color item_box_selected rgba(255, 255, 255, 0.16); +@define-color item_text_selected #999; +@define-color item_name_selected #eee; +@define-color item_shortcut_color #777; +@define-color item_shortcut_shadow darker(@bg_color); +@define-color item_shortcut_color_sel #78aeed; +@define-color item_shortcut_shadow_sel darker(@item_box_selected); + +.app { + background-color: @window_bg; + border-color: @window_border_color; + border-radius: 15px; +} + +.input { + caret-color: @caret_color; + color: @input_color; + border: solid 2px @blue_1; + border-radius: 5px; +} + +/* Selected Text in Input */ +.input *:selected, +.input *:focus, +*:selected:focus { + background-color: alpha (@selected_bg_color, 0.9); + color: @selected_fg_color; +} + +.item-text { + color: @item_text; +} + +.item-name { + color: @item_name; + font-weight: bold; +} + +.item-box { + background-color: rgba(255, 255, 255, 0.08); +} + +.selected.item-box { + background-color: @item_box_selected; + border: none; +} + +.selected.item-box .item-text { + color: @item_text_selected; +} + +.selected.item-box .item-name { + color: @item_name_selected; +} + +.item-shortcut { + color: @item_shortcut_color; +} + +.selected.item-box .item-shortcut { + color: @item_shortcut_color_sel; +} + +.prefs-btn { + opacity: 0.8; + padding: 13px; + border-radius: 10px; + transition: background-color 0.5s; +} + +.prefs-btn * { + box-shadow: none; +} + +.prefs-btn:hover { + background-color: @prefs_backgroud; + padding: 13px; + transition: background-color 0.5s; +} + +.no-window-shadow { + margin: -20px; +} diff --git a/files/ulauncher/themes/arc/manifest.json b/files/ulauncher/themes/arc/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": "1", + "name": "arc-dark", + "display_name": "Arc Dark", + "extend_theme": "dark", + "css_file": "theme.css", + "css_file_gtk_3.20+": "theme-gtk-3.20.css", + "matched_text_hl_colors": { + "when_selected": "#99ccff", + "when_not_selected": "#99ccff" + } +} diff --git a/files/ulauncher/themes/arc/theme-gtk-3.20.css b/files/ulauncher/themes/arc/theme-gtk-3.20.css @@ -0,0 +1,10 @@ +@import url("theme.css"); + +.input { + caret-color: @caret_color; +} + +/* Workaround for GTK+ < 3.20 */ +.selected.item-box { + border: none; +} diff --git a/files/ulauncher/themes/arc/theme.css b/files/ulauncher/themes/arc/theme.css @@ -0,0 +1,79 @@ +/* App Window */ +@define-color bg_color #404552; +@define-color window_bg @bg_color; +@define-color window_border_color #383c4a; +@define-color prefs_backgroud #999; + +/* Input */ +@define-color selected_bg_color #4675ab; +@define-color selected_fg_color #d5eaff; +@define-color input_color #ddd; +@define-color caret_color darker(@input_color); + +/* Result Items */ +@define-color item_name #ddd; +@define-color item_text #999; +@define-color item_box_selected #5294e2; +@define-color item_text_selected #99ccff; +@define-color item_name_selected #eee; +@define-color item_shortcut_color #777; +@define-color item_shortcut_shadow darker(@bg_color); +@define-color item_shortcut_color_sel #99ccff; +@define-color item_shortcut_shadow_sel darker(@item_box_selected); + +.app { + background-color: @window_bg; + border-color: @window_border_color; +} + +.input { + color: @input_color; +} + +/* Selected Text in Input */ +.input *:selected, +.input *:focus, +*:selected:focus { + background-color: alpha (@selected_bg_color, 0.9); + color: @selected_fg_color; +} + +.item-text { + color: @item_text; +} + +.item-name { + color: @item_name; +} + +.selected.item-box { + background-color: @item_box_selected; + border-left: 1px solid @window_border_color; + border-right: 1px solid @window_border_color; +} + +.selected.item-box .item-text { + color: @item_text_selected; +} + +.selected.item-box .item-name { + color: @item_name_selected; +} + +.item-shortcut { + color: @item_shortcut_color; + text-shadow: 1px 1px 1px @item_shortcut_shadow; +} + +.selected.item-box .item-shortcut { + color: @item_shortcut_color_sel; + text-shadow: 1px 1px 1px @item_shortcut_shadow_sel; +} + +.prefs-btn { + opacity: 0.8; +} + +.prefs-btn:hover { + background-color: @prefs_backgroud; +} diff --git a/files/xfce/settings/xfce4-keyboard-shortcuts.xml b/files/xfce/settings/xfce4-keyboard-shortcuts.xml @@ -64,6 +64,7 @@ <property name="startup-notify" type="bool" value="true"/> </property> <property name="&lt;Super&gt;e" type="string" value="exo-open --launch MailReader"/> + <property name="&lt;Super&gt;slash" type="string" value="ulauncher-toggle"/> </property> </property> <property name="xfwm4" type="empty"> diff --git a/lib/README.md b/lib/README.md @@ -16,6 +16,7 @@ The `lib` directory contains custom-made utility functions (exposed as `util`), - `filter`: Filters out unneeded `attrs` and maps required ones to specified function - `list`: Lists all toplevel `attrs` of `attrset` and returns a space-separated string - `file`: Maps all files with a particular extension adhering to a particular condition stored in a directory as an `attrset` acted upon by specified function. Enable `recursive` in order to recursively search inside directories + - `folder`: Maps all files with a particular extension stored in a directory to a given path as an `attrset` acted upon by specified function. Use `replace` in order to modify placeholder text - `modules`: Maps all configuration modules stored in a directory as an `attrset` acted upon by specified function - `list`: Maps all configuration files stored in a directory into a list for easy import - `name`: Same as `list`, but maps file names instead of paths diff --git a/lib/map.nix b/lib/map.nix @@ -7,6 +7,7 @@ lib: let isPath pathExists readDir + readFile toString typeOf ; @@ -24,6 +25,7 @@ lib: let mapAttrsToList nameValuePair removeSuffix + replaceStrings ; # Import Checks @@ -96,6 +98,24 @@ in rec { then nameValuePair name "${path}/flake.nix" else nameValuePair "" null) (readDir directory)); + # Configuration Folder Creation + folder = { + directory, + path, + extension ? "", + apply, + replace ? { + placeholders = {}; + values = {}; + }, + }: + mapAttrs' (name: value: + nameValuePair "${path}/${name}${extension}" (apply value)) + (files { + inherit directory extension; + apply = file: with replace; replaceStrings placeholders values (readFile file); + }); + # Package Patches patches = patch: if isPath patch diff --git a/modules/gui/default.nix b/modules/gui/default.nix @@ -3,11 +3,13 @@ options, lib, util, + pkgs, ... }: let inherit (builtins) map; inherit (util.map.modules) list name; - inherit (lib) mkOption optional types; + inherit (lib) mkIf mkOption optional types; + enable = config.gui.desktop != ""; in { imports = list ./. ++ list ./desktop; @@ -17,7 +19,15 @@ in { default = ""; }; - config.warnings = - optional (config.gui.desktop == "") - (options.gui.desktop.description + " is unset"); + config = { + # Warning + warnings = optional (!enable) (options.gui.desktop.description + " is unset"); + + # Desktop Integration + xdg.portal = mkIf enable { + enable = true; + xdgOpenUsePortal = true; + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + }; + }; } diff --git a/modules/gui/desktop/xfce.nix b/modules/gui/desktop/xfce.nix @@ -9,27 +9,7 @@ with files; let inherit (config.gui) desktop wallpaper; exists = app: builtins.elem app config.apps.list; - inherit (lib) mapAttrs' mkIf mkForce mkMerge nameValuePair replaceStrings; - - # Configuration Folder Creation - mkFolder = { - directory, - path, - extension ? "", - replace ? { - placeholders = {}; - values = {}; - }, - }: - mapAttrs' (name: value: - nameValuePair "${path}/${name}${extension}" { - text = value; - force = true; - }) - (util.map.files { - inherit directory extension; - apply = file: with replace; replaceStrings placeholders values (builtins.readFile file); - }); + inherit (lib) mkIf mkForce mkMerge replaceStrings; # GTK+ Theme theme = { @@ -106,13 +86,14 @@ in { # Utilities environment.systemPackages = with pkgs.xfce // pkgs; [ galculator + gnome.file-roller mate.atril orage pavucontrol plank system-config-printer transmission-gtk - xarchiver + ulauncher xfce4-clipman-plugin xfce4-eyes-plugin xfce4-notes-plugin @@ -126,7 +107,7 @@ in { xorg.xkill ]; - # Persisted Files + # Persisted Files1 user.persist = { directories = [ ".config/autostart" @@ -134,8 +115,10 @@ in { ".config/Mousepad" ".config/plank" ".config/Thunar" + ".config/ulauncher" ".config/xfce4" ".cache/xfce4" + ".local/share/ulauncher" ]; }; @@ -191,19 +174,24 @@ in { # Desktop Settings ".config/xfce4/terminal/terminalrc".text = xfce.terminal; } - // mkFolder { + // util.map.folder { directory = xfce.panel; path = ".config/xfce4/panel"; extension = ".rc"; + apply = text: {inherit text;}; replace = { placeholders = ["@font"]; values = [config.stylix.fonts.sansSerif.name]; }; } - // mkFolder { + // util.map.folder { directory = xfce.settings; path = ".config/xfce4/xfconf/xfce-perchannel-xml"; extension = ".xml"; + apply = text: { + inherit text; + force = true; + }; replace = { placeholders = [ "@system" @@ -224,7 +212,39 @@ in { config.stylix.fonts.monospace.name ]; }; - }; + } + ## 3rd Party Apps Configuration + // (with ulauncher; { + ## Launcher Settings + # Themes + ".config/ulauncher/user-themes" = { + source = themes; + recursive = true; + }; + + # Extensions + ".config/ulauncher/ext_preferences" = { + source = extensions; + recursive = true; + force = true; + }; + + # Scripts + ".config/ulauncher/scripts.json".text = scripts; + + # Settings + ".config/ulauncher/extensions.json".text = extension; + ".config/ulauncher/settings.json".text = + replaceStrings ["@terminal" "@theme"] ["xfce4-terminal" "arc-dark"] settings; + + # Autostart + ".config/autostart/ulauncher.desktop".text = '' + [Desktop Entry] + Type=Application + Name=ULauncher + Exec=${pkgs.ulauncher}/bin/ulauncher --no-window + ''; + }); # Dock Settings dconf.settings."net/launchpad/plank/docks/dock1" = { @@ -234,7 +254,6 @@ in { theme = "default"; }; - ## 3rd Party Apps Configuration # Code Editor programs.vscode = mkIf (exists "vscode") { extensions = [pkgs.code.vscode-marketplace.alvesvaren.arc-dark]; diff --git a/modules/gui/wayland.nix b/modules/gui/wayland.nix @@ -9,14 +9,8 @@ MOZ_ENABLE_WAYLAND = "1"; }; - # Legacy Programs Support + # Programs Support + xdg.portal.wlr.enable = true; programs.xwayland.enable = true; - - # Desktop Integration - xdg.portal = { - enable = true; - wlr.enable = true; - xdgOpenUsePortal = true; - }; }; }