Cursor Themes: Difference between revisions
imported>Erikarvstedt m mention `xsession.pointerCursor` option |
m Add category configuration |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
To install the DMZ white cursor theme with | To install the DMZ white cursor theme with add this to your [[Home Manager]] config: | ||
<code> | <code> | ||
Line 6: | Line 6: | ||
For a more fine-grained configuration, check the option <code>xsession.pointerCursor</code>. | For a more fine-grained configuration, check the option <code>xsession.pointerCursor</code>. | ||
== Cursor Theme with Home Manager == | |||
Here's an example how you can get a cursor theme from a url and assign it to HM's pointerCursor: | |||
<syntaxHighlight lang=nix> | |||
home.pointerCursor = | |||
let | |||
getFrom = url: hash: name: { | |||
gtk.enable = true; | |||
x11.enable = true; | |||
name = name; | |||
size = 48; | |||
package = | |||
pkgs.runCommand "moveUp" {} '' | |||
mkdir -p $out/share/icons | |||
ln -s ${pkgs.fetchzip { | |||
url = url; | |||
hash = hash; | |||
}} $out/share/icons/${name} | |||
''; | |||
}; | |||
in | |||
getFrom | |||
"https://github.com/ful1e5/fuchsia-cursor/releases/download/v2.0.0/Fuchsia-Pop.tar.gz" | |||
"sha256-BvVE9qupMjw7JRqFUj1J0a4ys6kc9fOLBPx2bGaapTk=" | |||
"Fuchsia-Pop"; | |||
</syntaxHighlight> | |||
== Troubleshooting == | |||
=== Cursor themes in Gnome apps under Hyprland are different / not applied === | |||
Try giving the Gnome apps an extra kick with:<syntaxhighlight lang="nix"> | |||
wayland.windowManager.hyprland.settings = { | |||
exec-once = [ | |||
# Fixes cursor themes in gnome apps under hyprland | |||
"gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'" | |||
"gsettings set org.gnome.desktop.interface cursor-size ${toString home.pointerCursor.size}" | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
=== Cursor themes in flatpaks are different / not applied === | |||
==== Set <code>xdg-desktop-portal-gtk</code> as fallback ==== | |||
Most flatpaks need the functions implemented by <code>xdg-desktop-portal-gtk</code> and other desktop portals are not always implementing everything in <code>xdg-desktop-portal-gtk</code> themself. So its a good idea to set<code>xdg-desktop-portal-gtk</code> as a fallback. | |||
This can be achieved in home-manager through <code>xdg.portals.config</code>:<syntaxhighlight lang="nix"> | |||
xdg.portal = { | |||
config = { | |||
# example with hyprland | |||
hyprland.preferred = [ "hyprland" "gtk" ]; | |||
}; | |||
}; | |||
</syntaxhighlight>OR in home-manager through <code>xdg.portals.configPackages</code>:<syntaxhighlight lang="nix"> | |||
xdg.portal = { | |||
# example with hyprland | |||
configPackages = [ pkgs.hyprland ]; | |||
# has a file with /nix/store/...-hyprland-.../share/xdg-desktop-portal/hyprland-portals.conf | |||
# 1 │ [preferred] | |||
# 2 │ default=hyprland;gtk | |||
}; | |||
</syntaxhighlight>Keep in mind that with the home-manager module <code>wayland.windowManager.hyprland.enable</code> this is already done. See [./Https://github.com/nix-community/home-manager/blob/22b418c13fb0be43f4bc5c185f323a3237028594/modules/services/window-managers/hyprland.nix#L298 github.com/nix-community/home-manager/blob/master/modules/services/window-managers/hyprland.nix] | |||
==== Make sure <code>xdg-desktop-portal-gtk</code> is running ==== | |||
For flatpaks you need to make sure the <code>xdg-desktop-portal-gtk</code> is running in userspace, which is not automatically always the case (espacially on tiling windowManagers). So in home-manager you can set:<syntaxhighlight lang="nix"> | |||
xdg.portal = { | |||
enable = true; | |||
extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; # Fixes OpenURI and cursor themes in flatpaks | |||
}; | |||
</syntaxhighlight> | |||
==== Giving flatpaks permission to ''<code>/nix/store</code>'' ==== | |||
This already fixes themes for most apps like gnome. But not all (e.g. Obsidian or Logseq). | |||
And since flatpaks are sandboxed and dont have access to the nix-store you need to give them permission, since the cursors are eventually linked to ''<code>/nix/store/...</code>'':<syntaxhighlight lang="shell"> | |||
flatpak --user override --filesystem=/nix/store:ro | |||
</syntaxhighlight>OR with the https://github.com/gmodena/nix-flatpak homeManagerModule:<syntaxhighlight lang="nix"> | |||
services.flatpak = { | |||
enable = true; | |||
overrides = { | |||
global = { | |||
Context.filesystems = [ "/nix/store:ro" ]; | |||
}; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
[[Category:Configuration]] |