gio set <folder path> metadata::custom-icon-name "folder-documents"
Thursday, 25 July 2019
How to set themable folder icon in GNOME3
In all systems, be it Windows, OSX or Linux, You can set folder icon in files explorer by selecting an icon in a properties window. But Linux encourages You to change system theme. If You want to use themable icon for a folder, which will change with a theme change, you can use gio command. For instance, if You want to have second documents folder, use the following command:
Monday, 22 July 2019
Post-install Fedora configuration
After installing Fedora, there are a few steps, to adjust the system to yourself. It will make the system unique and better fitted to the user.
When booting system, You can use <Esc> to access the boot menu or <shift> to show GRUB2's systems menu.
Decorations themes and icons themes can be found on gnome look. To use themes stored in the user's home folder, install user themes extension. When using Firefox, the gnome extensions webpage will guide You on how to enable managing GNOME extensions from it. After installing user themes extension, download themes:
Hiding GRUB2 menu
By default, if Fedora is installed alongside Windows, after booting a machine, systems menu is shown. To hide it, You should edit /etc/default/grub file and add the following lines:GRUB_TIMEOUT=0 # Time (in seconds) of showing systems menu
GRUB_HIDDEN_TIMEOUT=1 # Time (in seconds) of waiting for <shift> key to show systems menu
GRUB_HIDDEN_TIMEOUT_QUIET=true # Do not show systems menu
After saving the file, You should update GRUB2's configuration by using one of the commands:grub2-mkconfig -o /boot/grub2/grub.cfg # For BIOS systemsorgrub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg # For EFI systemsWhen booting system, You can use <Esc> to access the boot menu or <shift> to show GRUB2's systems menu.
Installing decorations theme and icons theme
Decorations themes and icons themes can be found on gnome look. To use themes stored in the user's home folder, install user themes extension. When using Firefox, the gnome extensions webpage will guide You on how to enable managing GNOME extensions from it. After installing user themes extension, download themes:
- decorations and shell themes to ~/.themes
- icon themes to ~/.icons
dnf install gnome-tweaksAfter starting the Tweaks app, go to Appearance category and select downloaded themes.Saturday, 20 July 2019
gitg here!
One thing, after moving to Linux, which annoyed me, was missing file explorer context menu option to open the default GNOME git browser - gitg. After learning, that You can extend GNOME Files app with Python scripts by using NautilusPython extension, I have added a simple tool to show gitg option in the context menu.
The extension can be downloaded from gnome-look.org or from GitHub.
The extension can be downloaded from gnome-look.org or from GitHub.
Friday, 19 July 2019
GNOME 3
For a while, I've been thinking about a switch to Linux. I use it in work on a daily basis, but on my own machine, I have Windows. I used Windows because I like playing computer games. But after buying Nintendo Switch, I was playing less and less. After watching YouTube videos about news in Linux evolution (this one is very interesting) and deciding to learn gtkmm, I have installed Ubuntu 19.04.
I have chosen Ubuntu because it is a system used in my work. After spending one day with Ubuntu 19.04 I saw, that it had a strange bug: if I have logged out and tried to log in again, the system would freeze. It was a small annoyance. But I was eager to learn something really new, use distribution used by GNOME developers and I have decided to switch to Fedora!
Fedora was a little more demanding to configure: I had to enable the non-free repository and swaps. Moreover, rclone browser's configure button was not working. It was complaining about missing environment variable. The fix was easy! I have only changed /usr/share/applications/rclone-browser.desktop file to contain
Update: The helpful folks at Fedora said, that it is better to define a TERMINAL variable in ~/.bashrc or ~/.profile file (see this bug).
My first two weeks with Fedora have passed and I like my new system. The only thing which I miss from Windows is Legimi app for synchronizing Kindle with Legimi's subscription.
I have chosen Ubuntu because it is a system used in my work. After spending one day with Ubuntu 19.04 I saw, that it had a strange bug: if I have logged out and tried to log in again, the system would freeze. It was a small annoyance. But I was eager to learn something really new, use distribution used by GNOME developers and I have decided to switch to Fedora!
Fedora was a little more demanding to configure: I had to enable the non-free repository and swaps. Moreover, rclone browser's configure button was not working. It was complaining about missing environment variable. The fix was easy! I have only changed /usr/share/applications/rclone-browser.desktop file to contain
Exec=env TERMINAL=/usr/bin/gnome-terminal /usr/bin/rclone-browser
instead ofExec=/usr/bin/rclone-browser
Update: The helpful folks at Fedora said, that it is better to define a TERMINAL variable in ~/.bashrc or ~/.profile file (see this bug).
My first two weeks with Fedora have passed and I like my new system. The only thing which I miss from Windows is Legimi app for synchronizing Kindle with Legimi's subscription.
Thursday, 1 February 2018
CMake and testing compilation failures
Creating header-only libraries with CMake is easy, one has to declare only INTERFACE parts of the library:
Of course, CMakeLists.txt for a library will have install and test steps. Testing compilable code can be done with help of many frameworks (Boost::Test, Google Test, lest or Catch), registered by add_test command and executed by ctest tool.
When testing, for each branch in code, one should consider testing it. With header-only libraries, there is a high probability, that there are compile-time conditional constructs (templates, macros). But there are currently no tools to test compile failures. CMake has a try_compile command, but it works during build generation and not during the build itself. So it will not rerun when a developer changes test or library code and executes build and tests. That is why, I have created AddCompileFailureTest - a simple CMake module, which enables testing compilation failures. Using it is straightforward. First, it has to be loaded in the main CMakeLists.txt:
Executing the test is simple and done from tests' CMakeLists.txt:
Function add_compile_failure_test works by creating a directory in the build tree and creating simple CMake project in it. This project contains a file with test case and CMakeLists.txt, which uses the try_compile command for checking for compilation errors in the test file. If the file can be compiled without errors, a build generation of the test project fails. The function add_compile_failure_test adds to ALL target a target for copying test file to build directory and test, which tries to generate build for the test project. The test fails, when build generation fails, ie. when test file can be compiled without errors.
# Nothing to build, so only declare name
add_library(lib_name INTERFACE)
# List all include directories with library headers
target_include_directories(lib_name INTERFACE include)
# Declare dependencies - other header only libraries
target_link_libraries(int_sum INTERFACE Boost::Boost)
Of course, CMakeLists.txt for a library will have install and test steps. Testing compilable code can be done with help of many frameworks (Boost::Test, Google Test, lest or Catch), registered by add_test command and executed by ctest tool.
When testing, for each branch in code, one should consider testing it. With header-only libraries, there is a high probability, that there are compile-time conditional constructs (templates, macros). But there are currently no tools to test compile failures. CMake has a try_compile command, but it works during build generation and not during the build itself. So it will not rerun when a developer changes test or library code and executes build and tests. That is why, I have created AddCompileFailureTest - a simple CMake module, which enables testing compilation failures. Using it is straightforward. First, it has to be loaded in the main CMakeLists.txt:
include(AddCompileFailureTest)Each expected compilation failure should be placed in proper source file within main function. Let us consider a simple sum function:template<typename T>
inline T sum(const T a, const T b) {
return a + b;
}It is obvious, that it will not compile for types, which do not have operator+ defined. The test case is:#include <sum.h>
class empty {};
int main() {
empty a;
empty b;
empty c = hlib::sum(a, b);
}Executing the test is simple and done from tests' CMakeLists.txt:
add_compile_failure_test(
NAME FailWithoutPlus
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/failing_withous_plus.cpp
INCLUDE_DIRECTORIES ${HLIB_INCLUDES}
)
HLIB_INCLUDES is a variable, which contains include path for a library with the sum function. Presented example is available on GitHub.Function add_compile_failure_test works by creating a directory in the build tree and creating simple CMake project in it. This project contains a file with test case and CMakeLists.txt, which uses the try_compile command for checking for compilation errors in the test file. If the file can be compiled without errors, a build generation of the test project fails. The function add_compile_failure_test adds to ALL target a target for copying test file to build directory and test, which tries to generate build for the test project. The test fails, when build generation fails, ie. when test file can be compiled without errors.
Friday, 19 January 2018
Modern CMake 101: Introduction
This post is part of a modern CMake tutorial: table of contents.
Modern CMake 101: Introduction
CMake is a cross-platform build system generator, tool to test and package applications. Over the years, it gained attention and now it is widespread. It can even be used in Visual Studio, from 2017 version up, out of the box. Over the years, CMake language has grown and philosophy of writing good build script has changed. There are many tutorials for writing CMake build scripts, but even the official one is outdated and doesn't show modern practices. This post summarizes key facts about creating modern CMake scripts.The first thing to do is to use recent enough version of CMake, ie. at least 3.0. Without it, one cannot follow best practices. See cmake_minimum_required.
The second thing is to forget about global variable, global compiler flags and thinking about directories. Modern CMake is all about modules and treating targets as objects. Targets have:
- named constructors:
- properties
- member functions
Because targets should be viewed as objects, one should carefully consider which parts of target create its interface and which are internal and used only to build a given target. There are three kinds of target properties:
- INTERFACE - properties creating an interface of target and used to build other targets depending on considered one.
- PRIVATE - private properties of the target, needed only to build target and should not be propagated to other targets.
- PUBLIC - properties which are both: INTERFACE and PRIVATE.
The third thing to keep in mind, when using a modern build tool, is to think about target dependencies and not about compile flags and directories. For expressing, that one target depends on the other, use target_link_libraries. As with all target data, one should carefully consider whether targets dependency should be in interface or not. To properly use targets from a different project, one should always export library interface with help of the install command and its exports mode.
Thursday, 18 January 2018
Windows 10 Pro
I have bought my laptop with Windows 8 Home upgraded to Pro edition, but I haven't got upgrade key from a shop (or it was hidden in the receipt and I forgot where the receipt was). Years have passed, Windows was upgraded to Windows 10 and then Visual Studio stopped working. I have fought bravely, to avoid Windows reinstallation, but MS help said that it was the only way to fix Visual Studio. Reluctantly, I have reinstalled Windows with the help of Media Creation Tool. Then, my Windows was reverted to Home edition and lost the ability to execute virtual machines! Few days with Google lead me to the page with a solution, and I have learned that:
So, if You bought PC with Home edition of Windows and have upgraded it to Pro version after Windows reinstallation, You should use key VK7JG-NPHTM-C97JM-9MPGT-3V66T!
If you performed a clean install using the Media Creation Tool it installs the specific edition based on the OEM Marker in the BIOS. So if the computer originally came preinstalled with Windows 7 Starter, Home Basic, Home Premium or Windows 8/8.1 Core/Single Language Windows 10 Home will be installed.
Workaround:
Upgrade to Windows 10 Pro using the following default product key:
VK7JG-NPHTM-C97JM-9MPGT-3V66T
So, if You bought PC with Home edition of Windows and have upgraded it to Pro version after Windows reinstallation, You should use key VK7JG-NPHTM-C97JM-9MPGT-3V66T!
Subscribe to:
Posts (Atom)

