Linux: Setting the default GDM login monitor in a multi-monitor setup using GNOME display settings

If you're using a multi-monitor setup with GDM (GNOME Display Manager) and the login screen consistently appears on the wrong monitor, this article presents a tested solution that can be applied either manually or automated, ensuring that the GDM monitor configuration matches that of your primary user setup. The issue Consider the following scenario: You have two monitors connected to an Nvidia graphics card, and despite setting the primary monitor correctly in GNOME, the GDM login screen still appears on the secondary monitor. Even if the secondary monitor is turned off, GDM continues to display the login prompt there, as … Continue reading

Git: Suppressing Irrelevant Git Diff Output for Specific Files (e.g., binary files, encrypted files...)

Sometimes, it is useful to suppress certain files from git diff output, especially when the files are large, machine-generated, or not intended for human reading. Typical examples include encrypted files such as *.gpg and *.asc, as well as binary assets like images, audio files, and similar media. These files are usually represented as opaque binary data in diffs, providing no useful information and adding extraneous clutter to git diff output. Git offers a solution for this through adding YOUR-FILE-PATTERN -diff -text to the .gitattributes file. Solution: A .gitattributes file that is local to the repository The .gitattributes file can be … Continue reading

stripspace.el - Ensure Emacs automatically removes trailing whitespace before saving buffers (optionally preserving the cursor column, normalizing indentation, and restricting whitespace cleanup to clean buffers)

Introduction The stripspace Emacs package provides stripspace-local-mode and stripspace-global-mode, which automatically removes trailing whitespace and blank lines at the end of the buffer when saving. (Trailing whitespace refers to any spaces or tabs that appear at the end of a line, beyond the last non-whitespace character. These characters serve no purpose in the content of the file and can cause issues with version control, formatting, or code consistency. Removing trailing whitespace helps maintain clean, readable files.) If this enhances your workflow, please show your support by ⭐ starring stripspace.el on GitHub to help more Emacs users discover its benefits. The … Continue reading

bufferfile: Rename, delete, or copy files and update their associated Emacs buffers (including clones and indirect buffers), buffer-local variables, and features that reference the file path, such as Eglot, Dired buffers, and the recentf list

The bufferfile Emacs package provides helper functions to delete, rename, or copy buffer files: bufferfile-rename: Renames the file visited by the current buffer (or safely retargets the buffer if the file does not yet exist on disk), ensures that the destination directory exists, and updates the buffer name for all associated buffers, including clones/indirect buffers. It also ensures that buffer-local features referencing the file, such as Eglot, Flymake, Dired buffers, or the recentf list, are correctly updated to reflect the new file name. bufferfile-delete: Delete the file associated with a buffer and kill all buffers visiting that file, including clones … Continue reading

persist-text-scale.el - Persist and Restore the Text Scale

The persist-text-scale.el Emacs package provides persist-text-scale-mode, which ensures that all adjustments made with text-scale-increase and text-scale-decrease are persisted and restored across sessions. As a result, the text size in each buffer remains consistent, even after restarting Emacs. This package also facilitates grouping buffers into categories, allowing buffers within the same category to share a consistent text scale. This ensures uniform font sizes when adjusting text scaling. By default: - Each file-visiting buffer has its own independent text scale. - Special buffers, identified by their buffer names, each retain their own text scale setting. - All Dired buffers maintain the same … Continue reading

Configuring Linux on a Lenovo ThinkPad T420s Laptop (Debian, Ubuntu, Linux Mint...)

ThinkPad T420s laptops, despite their age, remain reliable for web browsing, word processing, and various other tasks. Linux can breathe new life into such dated computers, allowing them to perform efficiently. I configured one of these laptops for my son, and he is now able to do his homework using it. With proper configuration, ThinkPad laptops can achieve optimal performance and power management. This article provides a guide to configuring X11/Xorg, kernel parameters, firmware, fan control, and power management settings to optimize the ThinkPad t420s for modern use. Some instructions in this article are specific to Debian/Ubuntu-based distributions, but they … Continue reading

jc-dotfiles - James Cherti's Dotfiles

The jc-dotfiles repository houses James Cherti's dotfiles and configuration scripts: Shell Configuration (.bashrc, .profile, and .bash_profile): Optimized Bash shell settings for efficient command execution and interactive sessions. Terminal Multiplexer (.tmux.conf): Configuration for Tmux, enhancing terminal session management and productivity. Readline configuration (.inputrc): Inputrc configuration that also allows using Alt-h, Alt-j, Alt-k, and Alt-l as a way to move the cursor. Other: .gitconfig (with support for difftastic), ranger, .ignore, .wcalcrc, mpv, picom, feh, and various scripts and configuration files for managing system settings, aliases, and more. Here are additional dotfiles and configuration files maintained by the same author: jc-dotfiles @GitHub: A … Continue reading

bash-stdops - A collection of useful Bash Shell Scripts

The jamescherti/bash-stdops project is a collection of helpful Bash scripts that simplify various operations, including file searching, text replacement, and content modification. I use these scripts in conjunction with text editors like Emacs and Vim to automate tasks, including managing Tmux sessions, replacing text across a Git repository, securely copying and pasting from the clipboard by prompting the user before executing commands in Tmux, fix permissions, among other operations. The bash-stdops Script Collection Overview Files, Paths, and Strings Git SSH Tmux X11/Wayland Misc Conclusion The jamescherti/bash-stdops scripts provide a variety of tasks, including file manipulation, Git management, and SSH automation, … Continue reading

Enhancing Git configuration ~/.gitconfig for performance, efficiency, data integrity, and workflow automation

Optimizing your Git configuration is fundamental to enhancing efficiency and productivity in version control workflows. A finely-tuned Git setup not only accelerates operations but also aligns the tool with the specific requirements of both individual developers and teams. In this article, we will explore Git configurations that enhance both performance and usability. All the configurations mentioned in this article should be added to the ~/.gitconfig file. This file follows the INI format, with [sections] defining categories and variables=values specifying settings. Performance tuning Garbage collection Core configurations Rebase Merge Pull Push behavior Enhanced diffing Rerere (Reuse Recorded Resolution) Commit Git log … Continue reading

Emacs: Toggling symbol highlighting with unique colors for each symbol using built-in functions

Symbol highlighting is a useful feature for quickly identifying occurrences of a symbol in a buffer. For example, when reading an algorithm with nested loops and multiple function calls, the distinct colors for each symbol, variable, or function make it easier to identify where each is used by simply scanning the highlighted symbols. This article presents a function that simplifies toggling the highlight for the symbol at point in Emacs using the built-in hi-lock package, which provides dynamic text highlighting. (The function provided in this article can serve as a replacement for packages like symbol-overlay or highlight-symbol if your primary … Continue reading

Emacs: Highlighting Codetags Like TODO, FIXME, BUG, NOTE...

Highlighting keywords such as TODO, FIXME, NOTE, BUG, and others (often referred to as tags, codetags, or tokens) enhances workflow by making key annotations more visible. This allows developers to quickly identify tasks, warnings, and notes within the code, reducing the time spent searching for unfinished work or potential issues. This article outlines an Elisp code that highlights these codetags. (There are packages like hl-todo and comment-tags that can highlight these codetags for those who need a more feature-rich solution. However, they contain hundreds of lines of code, which is excessive if your only goal is to just highlight codetags. … Continue reading

ansible-role-tuned

The ansible-role-tuned Ansible playbook manages the installation, configuration, and activation of the tuned service. Tuned is a dynamic adaptive system tuning tool used in Linux environments to optimize performance by adjusting various system settings dynamically. It provides pre-defined profiles that target specific use cases, such as high throughput, low latency, and energy saving, and automatically applies these configurations based on system activity. For high traffic servers, using Tuned is beneficial as it can enhance network throughput and responsiveness by adjusting parameters like CPU frequency scaling, I/O scheduling, and network stack settings. This optimization results in improved server performance, reduced latency, … Continue reading

Productivity: Time-saving tips for the digital age

Your computer is a powerful tool for enhancing productivity at work, but it can also be a significant source of inefficiency. Your time is a valuable resource. If, after hours of working at your computer, you find yourself accomplishing little, you may be among the many individuals distracted by the lure of the internet and digital technology. If you excel at time management, having schedules, goals, and structure in place is commendable. However, the effectiveness of time management diminishes if the time allocated is not directed toward advancing meaningful tasks. This article does not aim to teach you how to … Continue reading

buffer-terminator.el - Safely Kill Emacs Buffers Automatically to Enhance Emacs' Performance and Reduce Clutter in the Buffer List

The buffer-terminator Emacs package automatically and safely kills buffers, ensuring a clean and efficient workspace while enhancing the performance of Emacs by reducing open buffers, which minimizes active modes, timers, processes... Beyond performance, buffer-terminator provides other benefits. For instance, if you occasionally need to close annoying or unused buffers, buffer-terminator can handle this automatically, eliminating the need for manual intervention. (The default configuration is suitable for most users. However, the buffer-terminator package is highly customizable. You can define specific rules for retaining or terminating buffers by modifying the buffer-terminator-rules-alist with your preferred set of rules.) Activating (buffer-terminator-mode) safely terminates all … Continue reading

The compile-angel Emacs package: Byte-compile and Native-compile Emacs Lisp libraries Automatically

The compile-angel package speeds up Emacs by ensuring that all Elisp libraries are both byte-compiled and native-compiled: - Byte compilation speeds up loading Emacs Lisp code at runtime. - Native compilation improves performance by generating machine code that runs directly on the hardware. The actual speedup varies with the characteristics of the Lisp code, but it is typically 2.5 to 5 times faster than the equivalent byte-compiled version. For users looking to ensure a fully optimized environment, the compile-angel guarantees that every .el file in your load-path, including your own configuration and manually managed .el files, is properly byte and … Continue reading