New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure Global Cursor Theme - Breeze, Paper, etc... #22652
Comments
You might already know this, but for an individual user you can place the |
Yeah that's what I have now but it doesn't work for lightdm 😕 Also it just doesn't feel right making symlinks from the "Global" (environment.systemPackages) to that ~/.icons directory. |
I found this on the irc logs, but it's incomplete. https://botbot.me/freenode/nixos/2016-12-23/?msg=78370282&page=4 it doesn't show the rest of whatever derivation I suppose inf-rec ended up building? In anycase now I'm stuck trying to learn how to make a derivation just for the purpose of adding a simple file to a read only directory? 🤷♂️ life. |
Looking here: https://nixos.org/nixos/options.html#lightdm I think you can configure lightdm to use the Breeze theme by: {
services.xserver.displayManager.lightdm.greeters.gtk.iconTheme = {
package = pkgs.gnome-breeze;
name = "Breeze-gtk";
};
} or maybe using |
@grahamc Hey so I tried that but it just makes all the Icons like the face and the icons for buttons and stuff disappear or use their defaults or whatever. Neither option seems to affect the Mouse Cursor theme. Any other thoughts would be welcome? I've also tried looking at KDE code but it gets a bit confusing and I don't know what's relevant or not? |
I'm not sure about setting it globally but FWIW the way I deal with avoiding symlinks in ~/.icons is by installing the themes into my user's profile and then adding ~/.nix-profile/share/icons to
and sticking that into my .xsessionrc. For system-wide installed packages I believe lightdm could be modified to set For lightdm specifically I was able to patch its source, package definition and service to allow changing cursor theme in a way similar to how |
@pbogdan |
@pbogdan I just saw your comment and I was hoping someone had tried patching the lightdm derivation... the lightdm.greeters.gtk.iconTheme works well for icons and whatnot so I was hoping it could be extended to include the configurations for mouse theme. Didn't seem like it would be that difficult but you're correct about the versioning and I'm still not savvy enough with Nix as a language to know where to look to get on the right path. But seemingly mouse configuration and fhs user environments / nix-shell are still ambiguous to me. |
@srhb I tried installing @erlandsona you can see my lightdm changes here pbogdan@dfe9a15 They are applied on top of 17.03 channel so not sure if they would work with unstable or master. With those in place cursor theme in lightdm can be set in same way as theme / icon theme:
It would need some refining but I guess the changes could be submitted to nixpkgs though still not sure if that's a good idea. But in any case it seems to work for me. |
At the risk of sounding pedantic @pbogdan how do I use your patch? |
@erlandsona at the moment the only way I'm aware of would be creating your own nixpkgs fork then cherry picking my commit into your fork. Somehow I can't seem to be able to find documentation on that in the official manuals at the moment - are you familiar with working with your own fork? |
@pbogdan Forking projects in git yes... under the context of nix & channels and what not, no 😕 |
@erlandsona sorry for delay, I added some instructions based on how I work with my fork here |
Working off of pbogdan's work, I have devised a way to change the cursor globally when using lightdm-gtk-greeter; this was specifically asked on IRC by @ylwghst earlier this evening. Sharing here since I believe it can might help others too while waiting for a more comprehensive method. It might be possible to adapt this to another DM. In the example, it uses the { config, lib, pkgs, ... }:
let
# Not sure if this will work when changed, but this is a good default.
theme = config.services.xserver.displayManager.lightdm.greeters.gtk.iconTheme.package;
icons = config.services.xserver.displayManager.lightdm.greeters.gtk.theme.package;
# This is adapted from `<nixpkgs>/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix`
wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter"
{ buildInputs = [ pkgs.makeWrapper ]; }
''
# This wrapper ensures that we actually get themes
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
$out/greeter \
--prefix PATH : "${pkgs.glibc.bin}/bin" \
--set GDK_PIXBUF_MODULE_FILE "${pkgs.gdk_pixbuf.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
--set GTK_PATH "${theme}:${pkgs.gtk3.out}" \
--set GTK_EXE_PREFIX "${theme}" \
--set GTK_DATA_PREFIX "${theme}" \
--set XDG_DATA_DIRS "${theme}/share:${icons}/share" \
--set XDG_CONFIG_HOME "${theme}/share" \
--set XCURSOR_PATH "/run/current-system/sw/share/icons" \
--set XCURSOR_SIZE "64"
cat - > $out/lightdm-gtk-greeter.desktop << EOF
[Desktop Entry]
Name=LightDM Greeter
Comment=This runs the LightDM Greeter
Exec=$out/greeter
Type=Application
EOF
'';
in
{
environment.pathsToLink = [ "/share" ];
environment.systemPackages = with pkgs; [
paper-icon-theme
# Adds a package defining a default icon/cursor theme.
# Based off of: https://github.com/NixOS/nixpkgs/pull/25974#issuecomment-305997110
(pkgs.callPackage ({ stdenv }: stdenv.mkDerivation {
name = "global-cursor-theme";
unpackPhase = "true";
outputs = [ "out" ];
installPhase = ''
mkdir -p $out/share/icons/default
cat << EOF > $out/share/icons/default/index.theme
[Icon Theme]
Name=Default
Comment=Default Cursor Theme
Inherits=Paper
EOF
'';
}) {})
];
services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.lightdm.greeter.package = wrappedGtkGreeter;
} |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
This issue is still important to me. The lack of a "default" cursor theme may cause cursor related problems for many graphical programs implemented in Rust when using a Wayland compositor. The alacritty/alacritty#4780 may be one such example. I am working on narrowing this down further. |
I don't know if / when I'll ever contribute a proper solution, but using Maybe these hints will help someone write up a module for these things. |
While useful for some, I don't think depending on a display manager to set the cursor is ideal (I don't use any display manager; on Arch I just set it on ~/.Xresources and ~/.config/gtk-3.0/settings.ini). I'll look into xsettingsd |
The concern that I have with The Calling this approach an "XDG specification" is not exactly accurate. I was unable to find an XDG specification that specifically references this approach, though the approach does draw on elements of the Icon Theme Specification (specifically the format of the There is, though, some cross-distribution support for this approach. In addition to the description on the ArchWiki, this appears to be supported by default in Debian distributions (through the I have prepared a module for my local use which implements this strategy (and which does solve the problems I was having). This module relies on the # Module to set a default cursor theme
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.environment.defaultCursor;
indexThemeText = theme: generators.toINI {} {"icon theme" = { Inherits = "${theme}"; }; };
mkDefaultCursorFile = theme: pkgs.writeTextDir
"share/icons/default/index.theme"
"${indexThemeText theme}";
defaultCursorPkg = mkDefaultCursorFile cfg.theme;
in
{
options = {
environment.defaultCursor = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to set a default cursor theme for graphical environments.
'';
};
theme = mkOption {
type = types.str;
default = "";
example = "Adwaita";
description = "The name of the defualt cursor theme.";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [
defaultCursorPkg
];
};
} It may be possible to use some variation of this module to add this capability to NixOS generally. |
I marked this as stale due to inactivity. → More info |
Still relevant. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/alacritty-weird-focus-behaviour/20383/1 |
Issue description
On Arch Linux an index.theme file can be placed under /usr/share/icons/default/ which declares a simple Inherits line for configuring what the default cursor theme is. See https://wiki.archlinux.org/index.php/Cursor_themes
I'm trying to learn how to safely make a similar modification / configuration / derivation with Nix, so that I can experiment with cursor themes that behave consistently across the login manager and other applications.
Steps to reproduce
So far I've used lxappearance to quickly toggle between themes I've installed with environment.systemPackages and then created symlinks from /run/current-system/sw/share/icons/Breeze (for example) to my ~/.icons directory.
This is a local solution that only works post login and feels very brittle.
Technical details
The text was updated successfully, but these errors were encountered: