Skip to content

AguilarLagunasArturo/linux-workspace

Repository files navigation

Linux workspace (debian based distros - 2021)

This is the greatest management of all time.

Screenshots

Preview
Desktop
Desktop

Setup

# Update and install dependencies
sudo apt update
sudo apt upgrade -y
sudo apt install git stow jq

# Clone repo
cd ~
mkdir -p Github
cd Github
git clone https://github.com/AguilarLagunasArturo/linux-workspace.git

# Change directory and remove unneeded files
cd linux-workspace
rm README.md

# Install main packages (basic dependencies)
bash home/.homemade/bin/management/install-main-apt-packages

# Create config symlinks individually
stow -Svt ~ bash
stow -Svt ~ nano
stow -Svt ~ kitty

# Or create all at once
stow -Svt ~ *

# Restore deleted files
git checkout .

# Add settings to zshrc (optional)
echo "source ~/.rc_config &>/dev/null" >> ~/.zshrc

# Set default shell and terminal emulator (optional)
chsh
sudo update-alternatives --config x-terminal-emulator

# Reboot into an i3 session
systemctl reboot

Troubleshooting

Installing i3wm

If your distribution does not packages i3-gaps (check by running sudo apt policy i3-gaps) you can either:

  1. Install i3-gaps from source.
  2. Install i3 (without gaps) and remove the gaps settings from the config file.
    • sudo apt install i3-wm i3status i3lock
    • cat ~/.config/i3/config-no-gaps.bak > ~/.config/i3/config Once in an i3 super+enter to open a terminal, see the shortcuts here.

Bluetooth pairing

Install dependencies.

sudo apt install blueman
sudo apt install bluez*
sudo apt install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth

Make sure the Bluetooth service is enabled.

sudo systemctl enable bluetooth.service
sudo systemctl start bluetooth.service

Create the config file sudo nano /etc/bluetooth/audio.conf if not exists.

[General]
Enable=Source,Sink,Media,Socket

Then discover available devices and pair the one you need.

bluetoothctl
>> scan on
>> trust <MACADDRESS>
>> pair <MACADDRESS>

Notes

  1. home/.homemade is a directory for my custom resources, scrips, etc.
  2. Some scrips from home/.homemade/bin might not work properly.
  3. To set up the latest color scheme run nohup set-global-color-scheme $HOME/.config/xresources/color-schemes/x-default &>/dev/null && exit.

System configuration

Utility Name
Desktop enviroment gnome
Window manager i3-gaps
Login screen sddm, sugar-candy
Bar i3bar, i3status
Compositor picom
Launcher rofi
Terminal kitty, urxvt
Notifications dunst, notify-send

Keyboard shortcuts

Combination Description
super+enter Open terminal
super+ctrl+enter Open file manager
super+a Application launcher
super+b Show or hide i3-bar
super+0-9 Move to workspace
super+ctrl+right Move to next workspace
super+ctrl+left Move to previous workspace
super+shift+0-9 Move current window to workspace
super+ctrl+shift+0-9 Move all windows in current workspace to a new one
super+ctrl+shift+right Move current window to next active screen
super+ctrl+shift+left Move current window to previous active screen
super+right Focus next window
super+left Focus previous window
super+shift+w Kill current window
super+ctrl+shift Open conky
super+ctrl Close conky
super+l Brightness up
super+k Brightness down
super+alt+l Volume up
super+alt+k Volume down
super+v Next window opens below
super+h Next window opens to the right

See the other shortcuts in ~/.config/i3/config config file.

Stuff I have to do manually

Miscellaneous

Useful stow commands

stow --adopt -nvt ~ <stow-folder>  # Adopts config files to stow directory
stow --adopt -nSvt ~ <stow-folder> # Adopts config files to stow directory and then symlink them to $HOME directory
stow -nSvt ~ <stow-folder>         # Symlink config files to $HOME directory
stow -nDvt ~ <stow-folder>         # Removes symlinks from $HOME directory

Current session type

echo $XDG_SESSION_TYPE

Read manpages

# Case: 0
man <program-name>
# Case: 1
man -P "less -p 'CONFIGURATION SETTINGS'" <program-name>

Load Xresources

xrdb ~/.Xresources

Set default applications

# fetch the default mimetype from file
xdg-mime query filetype <file.ext>

# fetch the default application from mimetype
xdg-mime query default <mimetype>

# set default application for a mimetype
xdg-mime default </usr/share/applications/app.desktop> <mimetype>

# alternatively for gnome desktop enviroment edit this file
nano ~/.config/mimeapps.list

Set default terminal emulator

sudo update-alternatives --config x-terminal-emulator

Set default shell

# Manual
chsh -s /bin/shell <user>
# Interactive
chsh

Get application name

xprop WM_CLASS

ImageMagick allow Image to PDF

sudo nano /etc/ImageMagick-6/policy.xml
  <!-- disable ghostscript format types -->
  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <policy domain="coder" rights="none" pattern="PDF" /> <!-- CHANGE THIS -->
  <policy domain="coder" rights="none" pattern="XPS" />
  <policy domain="coder" rights="read | write" pattern="PDF" /> <!-- TO THIS -->

Install language support

sudo nano /etc/locale.gen  # Uncomment lines
sudo locale-gen            # Install uncommented languages

Github user settings

git config --global user.name "username"
git config --global user.email "email@domain.com"
git config --global credential.helper 'cache --timeout 1200'

Reset PulseAudio

pulseaudio -k && sudo alsa force-reload

Manage monitors

# List monitors
xrandr

# Configure position
xrandr --output HDMI-0 --left-of eDP --auto

Change hardware properties

# Install xinput
sudo apt install xinput

# List devices
xinput list

# Lits device properties
xinput list-props <device id>

# Set property
xinput set-prop <device id> <property id> <state 1/0>

Set wallpapers

# using feh
feh --bg-fill <img>

# using hydrapaper
hydrapaper -c <img>

Video conversion

# .mkv -> .avi
ffmpeg -i "input.mkv" -f avi -c:v mpeg4 -b:v 4000k -c:a libmp3lame -b:a 320k "out.avi"

# .mkv -> .avi (dual audio -> single audio)
ffmpeg -i "input.mkv" -map 0:v -map 0:a:1 -f avi -c:v mpeg4 -b:v 4000k -c:a libmp3lame -b:a 320k "out.avi"

# speed change
ffmpeg -i input.mp4 -filter:v "setpts=0.005*PTS" output.mp4

# crop video
ffmpeg -i input.mp4 -filter:v "crop:1920:1080:100:50" output.mp4

# Change container
ffmpeg -i input.mkv -codec copy output.mp4

Useful LaTex commands

# interactive compiler
latexmk -pdf -pvc <file.tex>
latexmk -lualatex -pvc <file.tex>

# just compile
latexmk -pdf <file.tex>
latexmk -lualatex <file.tex>

Redirect output

# redirects output
nohup commmand >/dev/null

# redirects stderr
nohup commmand 2>/dev/null

# redirects all
nohup commmand >/dev/null 2>&1
nohup commmand &>/dev/null

# redirects all and disown
nohup commmand > /dev/null 2>&1 & disown

Add .desktop file

# path to user .desktop files
cd /usr/share/applications

# path to snap .desktop files
cd /var/lib/snapd/desktop/applications
[Desktop Entry]
Type=Application
Name=A name
GenericName=Generic name
Comment=A comment
Exec=/path/to/bin
Icon=icon-name
Terminal=false
Categories=Development;IDE;Programming;
Keywords=software;programming;coding;

Change grub screen

# open config file
sudo nano /etc/default/grub
# Edit or add this lines
GRUB_BACKGROUND="/boot/grub/themes/your-theme/image.png"
GRUB_THEME="/boot/grub/themes/your-theme/theme.txt"
# update grub
sudo update-grub

Change timezone

# lists timezones
timedatectl list-timezones
# set new timezone
sudo timedatectl set-timezone <timezone>

Turn off screen saver for X Window Systems

xset s off

Sync clock with online services

# maintains the system time in synchronism with Internet standard time servers
sudo ntpd -qg

Fix dummy output

# Replace:
# GRUB_CMDLINE_LINUX_DEFAULT="quiet"
# With:
# GRUB_CMDLINE_LINUX_DEFAULT="quiet snd_hda_intel.dmic_detect=0"

sudo nano /etc/default/grub

Allow user to execute scripts as root

sudo nano /etc/sudoers
# Add line: user  ALL=(root) NOPASSWD: script-path

Useful paths

# Grub config file
nano /etc/default/grub
# Grub themes dir
cd /usr/share/grub/themes
# Systemd services dir
cd /etc/systemd/system
# Default background configuration
cd /usr/share/desktop-base/homeworld-theme/wallpaper/contents/images/
# Sudoers
sudo nano /etc/sudoers
# Compiled programs
cd $HOME/.local/share

Fix screen tearing on Gnome

Create the following config file in /etc/X11/xorg.conf.d/20-amd.conf

Section "Device"
        Identifier "AMD Graphics"
        Driver "amdgpu"
        Option "TearFree" "True"
EndSection

Firefox settings

Propertie Value
geo.provider.network.url https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%
full-screen-api.warning.timeout 0