Easy-to-use GNU/Linux desktop

I use a GNU/Linux desktop for both work and private life. Very free and easy to use. I've been using it for many years and have accumulated some knowledge, so I would like to introduce it. I think there are some parts that can be used with other OS.

Switch workspace [^ 1] according to purpose

[^ 1]: Also called a virtual desktop

Since it is a notebook PC, it basically does not start or stop the PC, and the application remains running. When doing parallel tasks, various information is mixed and chaotic and confusing, so I switch workspaces according to purpose. Every workspace has a browser (Firefox), a terminal (Tilix), an editor (Emacs), and in addition, launches the apps required for each task. For example:

--Workspace 1: Private Firefox (Profile: default), Emacs, Terminal --Workspace 2: Work (office work) Firefox (Profile: Office), Emacs, Terminal --Workspace 3: Work A Firefox (Profile: for Job A), Emacs, Terminal --Workspace 4: Work B Firefox (Profile: for Job B), Emacs, Terminal, Android Studio --Workspace 5: Job C Firefox (Profile: for Job C), Emacs, Terminal, Firefox 2nd

Here the terminal is launched as a separate process in each workspace. Emacs launches multiple windows from one instance with (make-frame) and places them in each workspace. Firefox starts with a different profile for each workspace (firefox -P <profile name>). By separating profiles, you can manage accounts for various services (Slack, Github, AWS, etc.) separately according to your purpose. Firefox can open the nth tab with Alt + n (number) . It is also convenient and often used to open the rightmost tab with Alt + 9 . The leftmost tab has rules such as communication tools (Slack, etc.), issue management next to it, and so on. Since the profile is also separated, for example, if you open a communication tool, operations such as Alt + 1 are unified, and you can search from multiple tabs. It can be operated linearly without the need. Since firefox for the task is arranged for each workspace, you can move tabs with unified key operation without confusion whether chat is Slack or Discord, repository is Github or gitlab.

By the way, the movement of the workspace is set to Alt + Fn (number) .

Switch focus

You can also switch the focus with Alt + Tab , but the operation of "switching and selecting in order" is stressful, so I want to switch with a shortcut. It is set as follows.

Key Focused app
Super+f (※1) Firefox
Super+e Emacs
Super+s Terminal
Super+o Something other than the above(※2)

(* 1) Super is the key with the windows logo next to alt. I'm pushing with the side of my left thumb. There is some training, but I get used to it soon (* 2) It depends on whether it is Android Studio or Chrome. When developing a web application, I also launch Firefox in another window. Even at this time, I want to distinguish between the first firefox and the second

The important point is that what you want to switch here is a specific window in your current workspace. I wrote a shell script because it can not be realized by setting because it can not be judged simply by the application name etc.

A. A script that saves the window id for each workspace B. Script that identifies the window id from the file generated in 1. for the application specified by the argument and switches the focus C. From the app on the current workspace, a script that finds the window id that does not exist in the file generated in 1. and switches the focus.

After starting the PC, after executing the script that creates the initial state (starting Firefox, Emacs, terminal of each workspace), the save script of A is called, and after that, the scripts of B and C are kicked from the shortcut.

Window resizing / moving

When you want to change the size of the window, it is basically enough to choose either to fit the screen size in each of the vertical and horizontal directions or to make it half the size. Since it is the screen size of a notebook PC, there is not much need for further division. In rare cases that I want to do other than that, I use the mouse to make adjustments. With that simplification, you can resize and move windows with Super + arrow keys . For example, if you press Super + , the script that performs the following processing is kicked.

--There is a margin on the "right" side of the current window ... --Move if there is. Move to the right by the width of the window. If it goes off the screen of the window, move it to fit the right edge. --If not, resize --The width of the window is the screen size ... --If they match, reduce the width of the window to half the screen size. --If not, match the width of the window to the screen size 2020-12-15 09-00-02.gif

The maximization is Super + Enter . Sometimes I want to glimpse if the program run in the shell has finished executing, so I also made a script to move it to the top of the panel. 2020-12-15 08-42-04.gif

Tab UI shortcut keys

Many recent apps have introduced a tab UI (firefox, chrome, AndroidStudio, terminal, etc.). Many apps use tab-related shortcuts, but there is a problem that the shortcuts are difficult to press. Since it is troublesome to change the shortcut for each application, the shortcut is changed at once by changing the keyboard mapping on the X side.

Keys actually pressed on the keyboard Key passed to the app motion
Super+[ Ctrl+PageUp Switch to the tab on the left
Super+] Ctrl+PageDown Switch to the tab on the right
Super+c Ctrl+F4 Close tab

In order to unify key operations such as moving divided screens in Emacs, it is set to (global-set-key (kbd"C- <next> ")'other-window).

Environmental details

The distribution uses Arch Linux, and the Window Manager (WM) uses Fvwm2. Fvwm has a long history, but it is still under development and Fvwm3 is currently under development. According to the information in here, Dr. Knuth is also using it.

I liked WM (stumpwm, xmonad, qtile, awesome, etc.), which allows me to write settings in a general-purpose programming language, but I didn't like them being basic tilting. Tiling WM seems to be popular in the world, but manual is enough for layout. There is a WM that can switch between tiling and floating (it seems that this is called dynamic WM), but if you use it as a floating WM, it is easier to use it exclusively for floating. After all, even if the setting itself is not a programming language, it was concluded that when performing complicated operations, you can call wmctrl or xdotool from the shell, or use the module pyewmh from python. .. However, ewmh is also quite delicate and resize does not consider the frame size, depending on the WM, the height of tint2 of the panel application is not reflected in workArea, and the subtle behavior differs for each WM. Some functions may not be implemented. After all, the dedicated setting description language is also convenient. Fvwm can call Fvwm commands with a CLI tool called FvwmCommand. The script for moving / resizing the window uses python to get the window size and conditional branching, and calls FvwmCommand from it.

Summary

There are twists and turns and it is in its current form, but if you summarize the lessons so far

――If you try to do everything with shortcuts, it will become complicated and some functions will not be used in the end. --Since the operations required in daily routines are limited, make them simple. ――It doesn't matter if the operation that occurs only occasionally is a little troublesome, but make it easy when you want to do it. --Leave the judgment of the context (ex. Is there a margin that can be moved) to the program so that it can be operated more simply.

Recommended Posts

Easy-to-use GNU/Linux desktop