This blog post documents my way of setting environment variables in Sway.
Let’s install qt6ct for some experiments.
1
sudo pacman-Sqt6ct
If we run it, we get the following problem:
Where can environment variables be specified when using Sway?
In my experiments, “~/.profile” is not loaded (either when logging in or using SDDM). Instead, “~/.bash_profile” and “~/.zshenv” should be used for BASH and ZSH, respectively.
So, in those files, source “~/.profile” explicitly
Shell
1
[[-f~/.profile]]&&.~/.profile
Let’s put the environment variable declaration and export into “~/.profile”
Shell
1
2
# For styling
export QT_QPA_PLATFORMTHEME=qt5ct
Exit Sway and get back in, and now qt6ct is happy:
If we want also to have our environment variables available to systemd, we can follow another strategy to specify environment variables in one place.
First of all, let’s create a file (or any, if you want to have several environment variables categorized in different files) that ends with “.conf” in the directory “~/.config/environment.d/”.
For example, I have “~/.config/environment.d/10-env.conf” (these files are read by systemd alphabetically); I move the environment variable definition in this file (so, I remove it from “~/.profile”):
Each time you modify that directory, you have to run this command:
1
systemctl--user daemon-reload
To verify that systemd read this file, run
1
systemctl--user show-environment
And you should see the line:
1
QT_QPA_PLATFORMTHEME=qt5ct
If you restart Sway and run qt6ct, you will see that qt6ct complains again. The environment variable is only visible to the systemd. We have to export the variables read by systemd.
To avoid duplication, we can use the program “/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator”, which does precisely that (of course, it handles all the environment variables in the “.conf” files in the environment.d directory). In “~/.profile” we now put this line:
Before KDE Plasma 6.1 (released a few days ago and already available in Arch), if you wanted to configure a “modifer-only” shortcut (e.g., SUPER key, also known as META, to activate the “Overview” effect), you had to manually modify the “~/.config/kwinrc” file and add these lines:
In Plasma 6.1, modifier-only shortcuts must not be specified in “~/.config/kwinrc”: they are in “~/.config/kglobalshortcutsrc” and, as such, can be visually specified through the standard KDE shortcut system settings:
By default, SUPER is configured to start the “Application Launcher” (this means that previous specifications in “ModifierOnlyShortcuts” in “~/.config/kwinrc” are not considered anymore).
If we want to assign it to “Overview”, we first search for current shortcuts for “Overview”:
Click on “Add custom shortcut” and press SUPER. You are notified about an existing binding for the “Meta” key:
And, of course, we choose to reassign it.
Done!
Thus, such a setting will be stored in “~/.config/kglobalshortcutsrc”:
1
2
[kwin]
Overview=Meta+W\tMeta,Meta+W,Toggle Overview
Nice feature, though it breaks existing configurations, which need to be adapted 😉
I’ll show how to do that in this blog post, assuming you’ve already installed a few KDE applications, like Dolphin, Konsole, and Kate (see the above-linked blog post).
WARNING: the strategy shown in this post is not optimal, in my humble opinion. There’s a more recent post where I show a better strategy (in my opinion).
As in all my Hyprland posts, this is based on Arch Linux; I mainly use EndeavourOS.
The crucial ones are the “qt5ct” and “qt6ct” packages. We’ll use the latter but also install the former for possible old Qt 5 applications, just in case. The “Hack” font is the standard KDE monospace font, and Kvantum is the theme engine.
Then, we have to set this environment variable in “~/.config/hypr/hyprland.conf” (note that we specify qt5ct, but for Qt 6 applications, qt6ct will be used automatically):
1
2
# For styling
env=QT_QPA_PLATFORMTHEME,qt5ct
Let’s restart Hyprland (I’m assuming “env = QT_QPA_PLATFORM,wayland” is also set).
That’s the standard style of Dolphin, Kate, and Konsole with the default settings:
Let’s open the “Qt6 Settings” application (corresponding to “qt6ct”).
Remember that Qt6 settings will be stored in the file “~/.config/qt6ct/qt6ct.conf”.
First of all, I’m changing the fonts to match the standard ones of KDE:
Remember always to click “Apply” after changing something”.
By restarting the above applications, the fonts now look like in a standard KDE system:
Let’s try to change the appearance colors to a darker setting in the palette:
Unfortunately, the result is a small disaster:
Dolphin is the only application that reacted to the change but in a wrong way.
Instead, let’s revert to the default palette and change the Style to Kvantum (“kvantum-dark”):
The result is improving:
However, it’s still ugly: the icons are mostly invisible, and the Konsole menu bar does not like this change.
Let’s fix the icons first: we select “Breeze Dark.” (Remember: We installed them at the beginning.)
The result has improved: icons are better visible, and in Dolphin, folder icons all look fine:
The rest of the ugly look is due to the default Kvantum theme.
So, from now on, we can try to select a Kvantum theme that makes the KDE applications look nice.
Let’s open Kvantum (“Kvantum Manager”) and try with another theme, e.g. “KvAdaptaDark”:
Now KDE applications look better:
Unfortunately, there’s a white bar in Konsole.
Moreover, Kate does not use the dark settings for the editor. However, Kate allows you to select a color scheme:
For example, by selecting “KvAdaptaDark” here as well, we get a nice-looking Kate:
Remember that Kvantum settings will be stored in the file “~/.config/Kvantum/kvantum.kvconfig”.
Now, you can experiment with other Kvantum themes.
For example, this is “KvArcDark”, which still has problems with Konsole menus:
Or “KvGnomeDark”, which doesn’t look bad after all (probably it’s the best up to now: we don’t even have the white bar in Konsole):
You can further tweak each Kvantum theme and change other settings in qt6ct.
In particular, you can install other icon packages and select another icon set in qt6ct.
Stay tuned for another post for styling Qt and KDE applications.
The new JvmGenericTypeValidator was introduced to automatically perform several Java-related checks in the hierarchy of the inferred JvmGenericTypes of an Xbase language, with the corresponding error reporting.
For example, cycles in a hierarchy, extension of a final class, proper extension of an abstract class (do you implement all the abstract methods or declare the inferred class as abstract?), proper method overriding, etc. It also performs duplicate elements checks, like duplicate parameter names, duplicate fields and duplicate methods (keeping the type-erasure into consideration when using types with arguments).
This mechanism assumes that you implement the JvmModelInferrer “correctly”.
It only checks the first inferred JvmGenericType for the same DSL element (i.e., if for an element Entity you infer two JvmGenericTypes, t1 and t2, only the first one will be checked).
Moreover, it only checks Jvm model elements with an associated source element.
Concerning intended classes to extend and interfaces to extend/implement, it assumes the model inferrer uses the new JvmTypesBuilder#setSuperClass(JvmDeclaredType, JvmTypeReference) and JvmTypesBuilder#addSuperInterface(JvmDeclaredType, JvmTypeReference), respectively.
Currently, this validator must be enabled explicitly through the composedCheck in the MWE2 file or the @ComposedChecks annotation in the validator, e.g., @ComposedChecks(validators = JvmGenericTypeValidator.class).
The Domainmodel example now uses this validator.
The Xtend validator has been refactored to also use this validator.
This means that if you implement your model inferrer “correctly” and enable this validator, you get lots of valuable checks, which you would usually have to implement yourself (if you ever did that).
Let’s see that in action in the Domainmodel example (you can materialize that in your workspace through the Xtext wizard).
Moreover, its model inferrer uses the above-mentioned API in JvmTypesBuilder for specifying the expected superclass, if present (note that setSuperClass is used here as an Xtend extension method and uses the syntactic sugar for setter):
Let’s start another Eclipse instance (in the GitHub project, you can use the launch “/org.eclipse.xtext.example.domainmodel.ui/Domainmodel Eclipse.launch”).
Let’s create an Eclipse plug-in project; in the MANIFEST, let’s add the Xbase lib as a dependency, and in the “src” folder, we create a file “Example.dmodel”, accepting to convert the project to an Xtext project.
Let’s start with a method with two parameters with the same name and see the reported error:
Let’s add two methods with the same name and a parameter but with the same type-erasure in the generic type:
Remember using setSuperClass to express that the extended class must be a class, not an interface? Let’s see that in action:
And don’t try to extend a final class 😉
Let’s see what happens if you try to extend an abstract class without defining all the abstract methods (remember that in the Domainmodel, all entities are mapped to concrete Java classes):
Of course, the error goes away if you implement the abstract methods:
Before going on, remember that implementing these validation checks manually is not trivial: you have to consider type-erasure and inherited methods. You get them for free thanks to the JvmGenericTypeValidator 🙂
Note that the error about missing implemented abstract methods, as the one above, contains information (i.e., in Xtext, “issue data”) about the missing methods, their types, and parameters. Thus, you could implement a quickfix to add the implementation methods automatically. This is not trivial, but it’s doable with the provided information. You might want to take inspiration from what Xtend does (remember that now Xtend uses the JvmGenericTypeValidator).
Let’s extend the Domainmodel a bit:
we add the optional “abstract” keyword for entities
we add the “implements” interfaces feature
These are the relevant parts in the modified grammar:
Let’s run MWE2 to regenerate the language, and let’s adapt the model inferrer accordingly (note the use of the new method JvmTypesBuilder.addSuperInterface; this method should also be used in the case your Xbase DSL has elements that are mapped to interfaces extending other interfaces):
Let’s restart the running Eclipse and see the new features in action, according to checks automatically performed by the JvmGenericTypeValidator.
For example, similarly to extended classes, we have the check for implemented interfaces:
Moreover, declaring a mapped Java class as abstract is taken into consideration: now we don’t have errors anymore with an abstract entity:
And, of course, mapped implemented interfaces are considered when checking whether a concrete class implements all the abstract methods:
Speaking of quickfixes, we can create a quickfix that intercepts the problem of a concrete entity missing implemented methods to turn the entity into an abstract one:
Other features not shown in this blog post and not implemented by the Domainmodel example are related to declared thrown exceptions in operations. The JvmGenericTypeValidator will check that the thrown exceptions are correct in the case of overridden methods, according to the Java semantics.
Note that the JvmGenericTypeValidator can be customized if needed. For example, Xtend customizes it.
On a side note, while I took care of implementing and testing the JvmGenericTypeValidator and refactoring Xtend validation accordingly, most of the code extracted in JvmGenericTypeValidator comes from the original implementation in the XtendValidator made by Sebastian Zarnekow!
I typically have several EndeavourOS installations on my computers: one for KDE, one for Hyprland, etc. Thus, I want to have different UEFI entries, but they would all have “endeavouros”, each overriding the others.
You can change the grub ID later by issuing a proper “grub-install” program from the running system or by booting it with the live ISO and then chrooting it.
Why not specify a different grub ID during the installation?
It’s easy to do so:
Once you boot the live ISO, before starting the installation, open a terminal (in the current version, the live environment is KDE, so you open Konsole);
Open the file “/etc/calamares/modules/bootloader.conf” with an editor (e.g., “sudo nano /etc/calamares/modules/bootloader.conf”; you need sudo but no password in the live environment);
Look for the line (near the end):
1
efiBootloaderId:"endeavouros"
and change it to a different string (e.g., “eos-kde” when you install KDE, “eos-gnome” when you install GNOME, etc.);
Save the file and go on with the installation as usual!
Now, each installation will have a separate and different grub id.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.