Code Monkey home page Code Monkey logo

nwg-look's Introduction

logo

nwg-look


This application is a part of the nwg-shell project.

Nwg-look is a GTK3 settings editor, designed to work properly in wlroots-based Wayland environment. The look and feel is strongly influenced by LXAppearance, but nwg-look is intended to free the user from a few inconveniences:

  • It works natively on Wayland. You no longer need Xwayland, nor strange env variables for it to run.
  • It applies gsettings directly, with no need to use workarounds. You don't need to set gsettings in the sway config file. You don't need the import-gsettings script.

nwg-look

Dependencies

Depending on your distro, you may also need to install gotk3 dependencies.

Installation

Packaging status

If nwg-look has not yet been packaged for your Linux distribution:

  1. Clone the repository, cd into it.
  2. make build
  3. sudo make install

Usage

$ nwg-look -h
Usage of nwg-look:
  -a	Apply stored gsetting and quit
  -d	turn on Debug messages
  -r	Restore default values and quit
  -v	display Version information
  -x	eXport config files and quit

The -a flag has been added just in case. When you press the "Apply" button, in addition to applying the changes, a backup file is also created. You may apply gsetting again w/o running the GUI, by just nwg-look -a. No idea if it's going to be useful in real life. ;)

Usage in sway

The default way to apply GTK setting on sway Wayland compositor has been described in the GTK 3 settings on Wayland Wiki section. You no longer need it. Nwg-look loads and saves gsettings values directly, and does not care about the ~/.config/gtk-3.0/settings.ini file. It only exports your settings to it, unless you use the -n flag.

Therefore, if your sway config file contains either

set $gnome-schema org.gnome.desktop.interface

exec_always {
    gsettings set $gnome-schema gtk-theme 'Your theme'
    gsettings set $gnome-schema icon-theme 'Your icon theme'
    gsettings set $gnome-schema cursor-theme 'Your cursor Theme'
    gsettings set $gnome-schema font-name 'Your font name'
}

or if you use the import-gsettings script:

exec_always import-gsettings

to parse and apply the settings.ini file, remove these lines.

Backward compatibility

Some gsetting keys have no direct counterparts in the Gtk.Settings type. While exporting the settings.ini file, nwg-look uses the most similar values:

gsettings Gtk.Settings
font-hinting gtk-xft-hintstyle
font-antialiasing gtk-xft-antialias
font-rgba-order gtk-xft-rgba

Some Other settings have been left just for LXAppearance compatibility, and possible use of your settings.ini file elsewhere:

  • Toolbar style
  • Toolbar icon size

have been deprecated since GTK 3.10, and the values are ignored.

  • Show button images
  • Show menu images

have been deprecated since GTK 3.10, and have no corresponding gsettings values.

  • Enable event sounds
  • Enable input feedback sounds

don't seem to change anything in non-GNOME environment.

nwg-look's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nwg-look's Issues

nwg-look UI doesn't keep the custom settings

I am running labwc as Wayland compositor on Arch Linux. When I change the fonts, icons, mouse etc. and apply the application shows the correct preview but when I open it again I see the default settings again. Oddly, the gtk3 settings.ini file show the changes instead.

Command-line option to export nwg-look preferences to files

(...) is it possible to have a command-line option to export nwg-look preferences to files? i use nwg-look to set my themes, and on top of that, i have darkman for automatic dark mode toggling. i set my theme to a light one during the day, and a dark one when it's night time, and apps under XWayland reads the gtk settings files instead of directly reading from gsettings, so having a command-line option for nwg-look to automatically export to files would be really neat!

Originally posted by @j1nxie in nwg-piotr/nwg-shell#157 (comment)

Nixpkg? [Feature Request]

I want to change my Hyprland cursor and was redirected to this repo. There seems to not be any nixpkg of this, so I'm making an issue for it

Where did the font settings go?

On your github README the screen shows default font options to choose from, but on the actual software it is missing as well as in the screen that you have on your website
I don't know any other software which could work with font settings under wlroots, so It would be nice to see it back.

Desire

I thought it was a good app, but it turned out to be a copy of LXappearance, with the same disease, so I deleted it...

The question is - why are you violating the XDG specification?
Why are you polluting the HOME catalog?

Themes and icons should be here
~/.local/share/icons
~/.local/share/themes

and gtk files should be here
~/.config/gtk-2.0/gtkrc
~/.config/gtk-3.0/settings.ini

icon folder location

The icon folder can be on two locations:

~/.icons
$XDG_DATA_HOME/icons

Can you support both locations?

Can't build the project from source

Problem

When I try to build nwg-look from source, I get the following

image

Info

I am on fedora 38. I have go installed (v.1.21.3), gtk3, and glib

Fedora Copr for all your projects

Hey bro, first off, I love your projects.

I use mostly your nwg-look which is wayyyy better than any other gtk-settings / theming app in my opinion.

Question:

Do you have any plans on maintaining a COPR repo for our fedora users?

Building from source is kinda takes long tbh and would be nice if there is for Fedora

(oh and maybe Debian) :)

TIA

Can't install to prefix other than /usr

The code to load data files (en_US.json and main.glade) is hardwired to use /usr/share as the location. This prohibits alternate installation locations (e.g. /usr/local). The getDataDirs() function in tools.go can easily be leveraged to provide a "search path" for locating these files. I will submit a pull request that implements this change for your consideration.

xsettings support

I'd like to suggest xsettings support using xsettingsd, since some xwayland apps I've found, mostly using electron apps, only seem to follow some settings from xsettings. xsettingsd by default uses .xsettingsd. More info about configuring it on their wiki: https://github.com/derat/xsettingsd/wiki/Settings

There is also GNOME's xsettings daemon gsd-xsettings, but I haven't tried it and don't know how it works.

Cursor.theme file not supported

Many cursor themes (such as quintom) do not ship with a index.theme file. Instead, they ship with a cursor.theme file. The syntax is indentical. Some ship with both as well.
As of now, nwg-look seems to only look for the index.theme file, and since the theme didn't have it it didn't show up in the cursor list.

Error: Couldn't load the basic lang file

I assume I screwed something up, this used to work just fine.

nwg-look -d                                                                                                                                                                                                                                           

INFO[0000] >>> Loading preferences                      
DEBU[0000] Loaded preferences: {"export-settings-ini":true,"export-gtkrc-20":true,"export-index-theme":true,"export-xsettingsd":true} 
WARN[0000] Couldn't determine your lang                 
INFO[0000] lang: en_US                                  
ERRO[0000] Couldn't load the basic lang file

I've tried to install both ngw-look and ngw-look-bin, same results. The en_US.json file seems to exist

sudo find / -iname en_US.json
                                                                                                                                                                                                                        
/home/xxx/.cache/paru/clone/nwg-look-bin/src/langs/en_US.json
/usr/share/nwg-look/langs/en_US.json

Let me know what I could have done to screw this up :(

Basic Keyboard Stortcut

There should a shortcut to apply sentings by Keyboard.
It could be implemented as when user press Alt Key highlight A for Apply and C for Close.
Hitting Alt+A will apply the settings.

Alt key is used as standard for this function in most other softwares (Firefox,xfce-apps,etc).
So It will be good to have it.

(Currently you need mouse for applying settings which is not so comfortable)

segfault on missing /usr/share/nwg-look/main.glade

I went a bit too fast whilst installing nwg-look and got the error below. Of course after installing main.glade at the right location this problem went away.

INFO[0000] input-feedback-sounds: false                 

(nwg-look:20058): Gtk-ERROR **: 22:09:16.247: failed to add UI: Failed to open file “/usr/share/nwg-look/main.glade”: No such file or directory
SIGTRAP: trace trap
PC=0x7f87a54a9e10 m=4 sigcode=128
signal arrived during cgo execution

goroutine 1 [syscall]:
runtime.cgocall(0x5bbee0, 0xc0000e5c50)
	/usr/lib/golang/src/runtime/cgocall.go:157 +0x5c fp=0xc0000e5c28 sp=0xc0000e5bf0 pc=0x48523c
github.com/gotk3/gotk3/gtk._Cfunc_gtk_builder_new_from_file(0x1f4abd0)
	_cgo_gotypes.go:6402 +0x49 fp=0xc0000e5c50 sp=0xc0000e5c28 pc=0x56cd09
github.com/gotk3/gotk3/gtk.BuilderNewFromFile({0x689f03?, 0x7?})
	/home/han/go/pkg/mod/github.com/gotk3/[email protected]/gtk/gtk_since_3_10.go:876 +0x67 fp=0xc0000e5ca8 sp=0xc0000e5c50 pc=0x58a207
main.main()
	/usr/pkgmk/work/nwg-look/src/nwg-look/main.go:333 +0x62c fp=0xc0000e5f80 sp=0xc0000e5ca8 pc=0x599c8c
runtime.main()
	/usr/lib/golang/src/runtime/proc.go:250 +0x212 fp=0xc0000e5fe0 sp=0xc0000e5f80 pc=0x4b6fd2
runtime.goexit()
	/usr/lib/golang/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0000e5fe8 sp=0xc0000e5fe0 pc=0x4e2721

rax    0x0
rbx    0x1
rcx    0xf
rdx    0x7f8770002
rdi    0x7
rsi    0x7f87700008e0
rbp    0x7f87792a34c0
rsp    0x7f87792a3420
r8     0x7f8770002fd0
r9     0x73
r10    0x0
r11    0xcdcd34f3ae091e21
r12    0x6
r13    0x0
r14    0x7f87a5584d00
r15    0x7f87a5584d90
rip    0x7f87a54a9e10
rflags 0x202
cs     0x33
fs     0x0
gs     0x0

Config Versioning Possibilities [Feature Request]

I like to keep track of my config files with git so I would like to know what files nwg-look stores configurations in / is dependant on. Git is also not great at handling binary files so if possible I would like to exclude such files from being versioned (such as dconf files).

What I'm Requesting:

  • Documentation for what files need to be versioned in order to be able to restore settings to a similar state with said files. I e I would like to be able to use git to restore my settings after for example a reinstallation.
  • If the above mentioned files include binary files (such as dconf files) then I would ideally want a way to export/import those configs in a more human readable and git friendlier text format. But if that functionality is out of scope or hard to implement then I am would be very happy to just have documentation for which settings are stored in that way. That way users can determine for themselves if they want to save save those settings.

gtk-4 support

It would be awesome if nwg-look could handle gtk-4.

Icon theme not being recognized.

My icon theme is symlinked from one location to ~/.local/share/icons, but it fails to be recognized. If I manually copy it to ~/.local/share/icons, it functions correctly. However, I have specific reasons for preferring to use a symlink. Are there any solutions to this issue?

[PATCH] Loading text scale from file

Hi,

Firstly I'd like to thank you for this project, it's been really helpful in my transition to Wayland.

I've noticed that currently when using nwg-look -a, the text scaling factor is not actually read from the file, and the default is instead used. I've had a go at creating a patch for it (see below), and it seems to work well on my end.

Cheers,
Grzegorz

From d6dd3f231f5fcfc6b75a17da66f369c7fd09061e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Grzegorz=20Cio=C5=82ek?= <[email protected]>
Date: Tue, 23 May 2023 16:46:01 +0100
Subject: [PATCH] Fixed text scale loading from file

---
 tools.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools.go b/tools.go
index fd98763..f6d5385 100644
--- a/tools.go
+++ b/tools.go
@@ -534,6 +534,11 @@ func applyGsettingsFromFile() {
 						gsettings.fontAntialiasing = value
 					case "font-rgba-order":
 						gsettings.fontRgbaOrder = value
+					case "text-scaling-factor":
+						v, err := strconv.ParseFloat(value, 64)
+						if err == nil {
+							gsettings.textScalingFactor = v
+						}
 					case "event-sounds":
 						gsettings.eventSounds = value == "true"
 					case "input-feedback-sounds":
-- 
2.39.3

nwg-look with KDE plasma 6

i 've installed the pkg so as to correct font issues with some gtk apps on endeavourOS (arch + plasma6) .
It does the job pretty well, but:

  1. Why to block the app to create Desktop entry on the user desktop for GNOME;XFCE;MATE;KDE ?
  2. in the console i get:
WARN[0000] Unsupported config key: gtk-decoration-layout 
WARN[0000] Unsupported config key: gtk-enable-animations 
WARN[0000] Unsupported config key: gtk-modules          
WARN[0000] Unsupported config key: gtk-primary-button-warps-slider 
WARN[0000] Unsupported config key: gtk-sound-theme-name 
WARN[0000] Unsupported config key: gtk-xft-dpi 
...
WARN[0018] Couldn't find icons folder ```

3) can you limit the production of GTK config files base on the default path of the major distros



Operating System: EndeavourOS 
KDE Plasma Version: 6.0.3
Graphics Platform: Wayland

'g_binding_get_target' is deprecated

I'm stuck on this message

❯ make build
go build -o bin/nwg-look .
# github.com/gotk3/gotk3/glib
cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_source’:
cgo-gcc-prolog:71:2: warning: ‘g_binding_get_source’ is deprecated: Use 'g_binding_dup_source' instead [-Wdeprecated-declarations]
In file included from /usr/include/glib-2.0/glib-object.h:24,
                 from /usr/include/glib-2.0/gio/gioenums.h:30,
                 from /usr/include/glib-2.0/gio/giotypes.h:30,
                 from /usr/include/glib-2.0/gio/gio.h:28,
                 from ../../go/pkg/mod/github.com/gotk3/[email protected]/glib/gbinding.go:3:
/usr/include/glib-2.0/gobject/gbinding.h:115:23: note: declared here
  115 | GObject *             g_binding_get_source          (GBinding *binding);
      |                       ^~~~~~~~~~~~~~~~~~~~
cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_target’:
cgo-gcc-prolog:107:2: warning: ‘g_binding_get_target’ is deprecated: Use 'g_binding_dup_target' instead [-Wdeprecated-declarations]
/usr/include/glib-2.0/gobject/gbinding.h:119:23: note: declared here
  119 | GObject *             g_binding_get_target          (GBinding *binding);
      |                       ^~~~~~~~~~~~~~~~~~~~

NixOS support

Do you have any plans on getting nwg-look packaged on NixOS? Thanks.

First impression and some small issues

First of all, I would like to thank you for your tireless efforts. I use nwg-shell components in yocto/openembedded build environment and I am really thankful for that tools that enrich wlroots/sway a lot.

Found two small issues:

Icon=nwg-look.svg

I guess we would need to remove .svg from this line

And if wearing the distributors hat, i'd like to have a LICENSE file to ship with the package

Apart from this i did succeed in building nwg-look for x86-64 and aarch64.

Looks awesome. Great work!

make build stuck

Hello! When I run make build inside the cloned repository, the process gets stuck in github.com/gotk3/gotk3/gtk, and doesn't proceed. I initially tried it with makepkg from the AUR, and when I encountered this error, I tried to build from source by cloning the repository and building it. Both of the attempts resulted in the same thing.

GTK2 file not being created even though checkbox is set

Attempting to set a theme, running Hyprland WM setting WhiteSur theme. Everything applies correctly but the gtk2 file does not get saved. I do have GTK2_RC_FILES defined, idk if thats meant to break the app but it doesnt respect this env either. There are 0 traces of any gtk2 files created on the system.

By constrast, lxappearence did make them. I recently switched from lxappearance to this, because I was recommended it. Any ideas what might be happening?

Changing cursor changes icons, unable to change icons back afterwards

Greetings. First of all, I'd like to thank you for this very useful software.

I am using nwg-look to change the look of gtk on hyprland. I was using breeze-dark icons and cursor, when I decided to change the cursor to Catppuccin-Mocha-Dark from the AUR. In selecting a different cursor, all icons changed to adwaita (i noticed this on thunar, which is the main gtk program i use), and all my attempts to set a different icon set were for naught, as I seem to be unable to change the icons using nwg-look. I have had to install kde-plasma and make the change there in order to be able to have my old icons with the new cursor.

I'm attaching a video showcasing the issue as well as a log file of the output of nwg-look.

nwg-look-cursor-issue.mp4

nwg-look.log

Fonts are set by display name instead of font family name

Font displays as "None" if the specified font family is different from display name

So, let's say there's 'JetBrainsMono NF SemiBold 12', but there's also 'JetBrainsMono Nerd Font SemiBold 12'
Even though both variants properly change the displayed font in GTK, only first option works properly with Java Swing (If it's using GTK look and feel).
It seems to only fork if there's a font with exact family name in fc-list

Here are the lines where this issue originates from:

https://github.com/nwg-piotr/nwg-look/blob/main/uicomponents.go#L245
https://github.com/nwg-piotr/nwg-look/blob/main/uicomponents.go#L247

Attached screenshot with the demonstration of the issue:
Top screenshot: Swing properly changes font, but nwg-look's font selector displays it as "None"
Bottom screenshot: Swing fallsback to using another font, but the font in nwg-look is properly shown
image
image

If the fonts were set by family name (which is shown in fc-list) instead of display name, that would also fix fonts in java applications.

Build Error in Arch, using Paru to install nwg-look-git

using arch, I get the following error when paru tries to install:

github.com/gotk3/gotk3/glib

cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_source’:
cgo-gcc-prolog:71:2: warning: ‘g_binding_get_source’ is deprecated: Use 'g_binding_dup_source' instead [-Wdeprecated-declarations]
In file included from /usr/include/glib-2.0/glib-object.h:24,
from /usr/include/glib-2.0/gio/gioenums.h:30,
from /usr/include/glib-2.0/gio/giotypes.h:30,
from /usr/include/glib-2.0/gio/gio.h:28,
from ../go/pkg/mod/github.com/gotk3/[email protected]/glib/gbinding.go:3:
/usr/include/glib-2.0/gobject/gbinding.h:115:23: note: declared here
115 | GObject * g_binding_get_source (GBinding *binding);
| ^~~~~~~~~~~~~~~~~~~~
cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_target’:
cgo-gcc-prolog:107:2: warning: ‘g_binding_get_target’ is deprecated: Use 'g_binding_dup_target' instead [-Wdeprecated-declarations]
/usr/include/glib-2.0/gobject/gbinding.h:119:23: note: declared here
119 | GObject * g_binding_get_target (GBinding *binding);
| ^~~~~~~~~~~~~~~~~~~~

Now my gnome apps use different colors

Hello, I tried this out on arch linux, sway 1.7 with a couple gnome apps.

I used Adapta before and used nwg-look to try and switch to Adwaita and/or Adwaita-dark:
image

At first it seemed to work: easyeffects and the keyring unlock dialogue both now use the theme as shown by nwg-look's preview.
But then I noticed that galculator and evince use a light theme version instead:
image

Am I doing something wrong?

the cursor size function not working

hi when i set a size for the cursor it dosen't apply it.(it only applys it for google chrome)
i did get it working by setting the cursor in .Xresources
but i wanted to inform you with this problem

i'm using dwm on debian 12

undefined variables when using make build in void linux

I already have go 1.20, gtk+3-devel, xcur2png, glib-devel, and cairo installed all through xbps which I'm pretty sure covers everything. This might be a void specific thing, or I messed something up

Output of make build
`go build -o bin/nwg-look .

github.com/nwg-piotr/nwg-look

./main.go:29:29: undefined: gtk.Settings
./main.go:34:29: undefined: gtk.Viewport
./main.go:35:29: undefined: gtk.ScrolledWindow
./main.go:36:29: undefined: gtk.ListBox
./main.go:37:29: undefined: gtk.MenuBar
./main.go:38:29: undefined: gtk.Grid
./main.go:39:29: undefined: gtk.Grid
./main.go:40:29: undefined: gtk.Frame
./main.go:41:29: undefined: gtk.Box
./main.go:42:29: undefined: gtk.Frame
./main.go:42:29: too many errors
make: *** [Makefile:7: build] Error 1`

Feature request: make it a a standalone app

The new settings and welcome even for those who are not using nwg-shell. It would be great to be able to install it as a standalone application. instead of lxappearence.

~/.icons/default folder should get created if it does not exist

If you set a custom cursor theme without that folder, index.theme will never be created and the settings are not properly applied. For any updated setting file nwg-look should create the folder if it does not exist.

~/.icons/default/index.theme

Workaround:

mkdir -p ~/.icons/default

Change GTK settings via command line

Hello is there or in plan to have possibility to change setting directly from command line?

Could be useful to quickly change let's say GTK theme between light and dark theme via keybinding.

Something like:
nwg-look -c gtk-theme="theme-name"

Thank you!

What is the proper way to set the cursor theme?

OS: Arch Linux
WM: wlroots-based
nwg-look: 0.1.1

First off, thanks for this great tool, it very much improves the user experience of theming!

Not sure whether this is a bug, but when picking a cursor theme I still have to set the theme manually in ~/.icons/default/index.theme to make it visible on the plain WM layer/background (on waybar and GUI apps it's working as expected), leaving it blank will make the theme fall back to the "system" cursor.

Any ideas are appreciated,
Thanks again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.