POSTS
My New-New Linux
BlogSo I was feeling pretty good about my recent minimalist Linux laptop build, but something kept bothering me: there was a lot more desktop around the base install of Ubuntu Mate than I wanted. Additionally it appeared that there was some sort of kerfuffle about needing to pay to ensure that some apps (which were optional to use, sure) received security updates.
Frankly, I didn’t need the giant desktop and I didn’t want to find myself in some sort of situation of needing to subscribe to something to have this laptop be secure. I went looking for the most intentionally-stripped down distribution that wasn’t an explicit “Designed to run on a Raspberry Pi or an eee PC from 2002” distribution. My laptop is old, but it’s not a hardware hobbyist platform / hobbled.
AntiX
So I started playing with a few more distributions. One that was really
attractive was antiX, a Debian-based distribution whose core install was more
stripped down than Mate, fit into a smaller space footprint, and really kept
out of the way. I also like that it takes an explicitly anti-capitalist take to
computing hardware and promises that your “old” laptop is “plenty good
enough.“1
It’s a distribution of strong Unix opinions (preferring
the rcS
script architecture over systemd
is a gutsy take) and minimalism.
But the thing was, as I was looking for some support on how to tweak something for antiX, some wag asked, well if yore going to go that minimal, why not simply use Debian? This question really stuck with me given that:
- antiX is based on Debian
- Ubuntu Mate is based on Debian
- Debian is one of the distributions most-committed to the open-source philosophy
Remembering the swirl icon on CD reminded me of my early enthusiasm for Linux and open source again. It was my main OS on my home computer from 2000-2003 when I moved to Mac OSX. Could I go back home after nearly 20 years away? I decided to give the Debian installer a go.
Debian
I imaged a USB key with the Debian netinst
. That means that the USB key is
pretty light and you’ll need a network connection. Back in the day, that meant
a rope of Ethernet cable, but now the installer gets your WiFi up and running
before it gets underway.
I used the text based installer. It was splendidly spartan. After configuring my disk partitions (an advanced choice; I cover my install formula below in high-detail), the installer asked me to verify the package set. I notably had to uncheck the desktop environment and check only “system tools.” The installer then went to work. A few minutes later, I rebooted.
As it booted up, I was dropped into a console with nothing else. I tried coding this way for a bit. Just my terminal and a book (OK, iPad). This was a really great way to Get Work Done and, honestly, I think when I’m really trying to focus, this is going to be my preferred route. The only downside was that I didn’t have a battery indicator, so I didn’t notice that my laptop was dying until it was dead. I fixed this by writing a little code to provide a battery percentage in my prompt.
I was tempted to leave things this way, but the need for a PDF viewer and a browser really suggested some graphical environment. I just wanted it to be minimalist in look and feel.
My solution here was to install Wayland and Sway. Wayland is a rendering
technology that I don’t know anything about. Sway is a technology for putting
windows on a screen in a keyboard-driven manner. These two together create a
minimalist experience but provide just enough graphics interface scaffolding
for a few graphical apps. I installed a PDF viewer called “Zathura,” the
Firefox browser, and that was it. A simple invocation of apt
(details below)
got these installed. It looks like this:
Developing the plan I shared below took a little bit of effort, but now I have a wonderful environment for coding and researching that affords few distractions on a highly-open-source oriented OS. If you have ~20 gigabytes, I’ll suggest a glorious build that can make even decades old machines feel brand new. It also has a few features for the more ahem mature Linux user who might prefer bigger fonts. For those wanting a bespoke experience, here’s mine.
⚠️ Nerdy installation plan below⚠️
It need not be this complicated, the Debian installer can give you a rich alternative to Windows and Mac with a few default settings.
Install Plan (High Detail)
The first key was to come up with a better partitioning scheme. If this didn't work out, I didn't want to have to migrate my data. So I created a `/home` partition to hold my home directory: `.vimrc`, Sway configs and downloads would be safe from future imaging. I also created another partition for holding directories that are clones of repositories. I don't want these cluttering my home directory on my `/home` partition. Backing up my home directory can now be done on a USB key because things that have remote backup built-in (as any code I check out does) doesn't need it. == Medium == Debian netboot should be sufficient provided one has network. == Partitioning == Model: ATA SanDisk Z400s 2. (scsi) Disk /dev/sda: 128GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 106MB 105MB fat32 EFI System Partition boot, esp 2 106MB 123MB 16.8MB Microsoft reserved partition msftres 3 123MB 95.6GB 95.5GB ntfs Basic data partition msftdata 4 95.6GB 106GB 10.0GB ext4 Debian OS 7 106GB 110GB 4000MB linux-swap(v1) swap swap 8 110GB 116GB 5999MB ext4 Data 6 116GB 127GB 11.5GB ext4 /home 5 127GB 128GB 944MB ntfs Basic data partition hidden, diag The partitions to pay attention to are that I allocated 10GB for debian (sda4) and 11.5GB (sda6). Splitting these two means I can upgrade OS (sda4) and just "re-attach" /home (where my personal, volatile files are) by mounting sda6. To further cut down on stuff that *is* backed up (i.e. is in git) from cluttering up my home directory. I symlinked ~/Projects to /Data (sda8). I also added 4 GB of swap (the memory that's on this system). == Packages == Only install the system utilities. No desktops or any of that. = Once you're booting up = == Ctrl Caps in the Terminal== vi /etc/default/keyboard add ,ctrl:nocaps run sudo setupcon == Set EDITOR to vim == TMUX responds to this and generally, it makes life better == Install Miscellaneous Software == sudo ssh bc vim tmux git wayland sway foot inxi light lynx parted mako-notifier swaylock wl-clipboard grim slurp jq hugo clisp firefox-esr fonts-iosevka foot-themes fuzzel grimshot gsfonts fonts-color-noto-emoji fonts-hack zathura tig wofi wtype (Clone-able executables) wofi-emoji diff-so-fancy == Vim Extensions == Go in: ~/.vim/pack/plugins/start/ https://github.com/preservim/nerdcommenter.git https://github.com/tpope/vim-surround = Post-Config Options = Font line in foot.ini: `font=Hack:size=12,NotoColorEmoji:size=12,monospace:size=12` == Sway Config == # Default config for sway # Read `man 5 sway` for a complete reference. ### Variables # # Logo key. Use Mod1 for Alt. set $mod Mod4 # Home row direction keys, like vim set $left h set $down j set $up k set $right l # Your preferred terminal emulator set $term foot # Preferred browser (install with apt) set $browser firefox # Your preferred application launcher # requires apt install fuzzel set $menu fuzzel | xargs swaymsg exec -- include /etc/sway/config-vars.d/* ### Output configuration # # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) # (apt install sway-backgrounds) # # Example configuration: # # output HDMI-A-1 resolution 1920x1080 position 1920,0 # # You can get the names of your outputs by running: swaymsg -t get_outputs output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill ### Idle configuration # # Example configuration: # bindsym $mod+Shift+Escape exec swaylock -f -c 000000 exec swayidle -w \ timeout 300 'swaylock -f -c 000000' \ timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ before-sleep 'swaylock -f -c 000000' # # This will lock your screen after 300 seconds of inactivity, then turn off # your displays after another 300 seconds, and turn your screens back on when # resumed. It will also lock your screen before your computer goes to sleep. ### Inputs configuration # # You can get the names of your inputs by running: swaymsg -t get_inputs # Read `man 5 sway-input` for more information about this section. input "1:1:AT_Translated_Set_2_keyboard" { xkb_options { ctrl:nocaps } } input "1739:32382:DELL073B:00_06CB:7E7E_Touchpad" { dwt enabled tap enabled natural_scroll enabled pointer_accel 0.7 } ### Key bindings # # Basics: # # Start a terminal bindsym $mod+Return exec $term bindsym $mod+Shift+Return exec $term --config /home/heraclitus/.config/foot/foot.solarized.ini bindsym $mod+Shift+9 exec $term --config /home/heraclitus/.config/foot/foot.solarized-dark.ini # Need a browser bindsym $mod+Shift+b exec $browser # Kill focused window bindsym $mod+Shift+q kill # Start your launcher bindsym $mod+d exec $menu # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. # Despite the name, also works for non-floating windows. # Change normal to inverse to use left mouse button for resizing and right # mouse button for dragging. floating_modifier $mod normal # Reload the configuration file bindsym $mod+Shift+c reload # Emoji support bindsym $mod+Alt+e exec $HOME/bin/wofi-emoij # Exit sway (logs you out of your Wayland session) bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' # # Moving around: # # Move your focus around bindsym $mod+$left focus left bindsym $mod+$down focus down bindsym $mod+$up focus up bindsym $mod+$right focus right # Move the focused window with the same, but add Shift bindsym $mod+Shift+$left move left bindsym $mod+Shift+$down move down bindsym $mod+Shift+$up move up bindsym $mod+Shift+$right move right # Workspaces: # # Switch to workspace bindsym $mod+1 workspace number 1 bindsym $mod+2 workspace number 2 bindsym $mod+3 workspace number 3 bindsym $mod+4 workspace number 4 bindsym $mod+5 workspace number 5 bindsym $mod+6 workspace number 6 bindsym $mod+7 workspace number 7 bindsym $mod+8 workspace number 8 bindsym $mod+9 workspace number 9 bindsym $mod+0 workspace number 10 # Move focused container to workspace bindsym $mod+Shift+1 move container to workspace number 1 bindsym $mod+Shift+2 move container to workspace number 2 bindsym $mod+Shift+3 move container to workspace number 3 bindsym $mod+Shift+4 move container to workspace number 4 bindsym $mod+Shift+5 move container to workspace number 5 bindsym $mod+Shift+6 move container to workspace number 6 bindsym $mod+Shift+7 move container to workspace number 7 bindsym $mod+Shift+8 move container to workspace number 8 # bindsym $mod+Shift+9 move container to workspace number 9 bindsym $mod+Shift+0 move container to workspace number 10 # Note: workspaces can have any name you want, not just numbers. # We just use 1-10 as the default. # # Layout stuff: # # You can "split" the current object of your focus with # $mod+b or $mod+v, for horizontal and vertical splits # respectively. bindsym $mod+b splith bindsym $mod+v splitv # Switch the current container between different layout styles bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split # Make the current focus fullscreen bindsym $mod+f fullscreen # Toggle the current focus between tiling and floating mode bindsym $mod+Shift+space floating toggle # Swap focus between the tiling area and the floating area bindsym $mod+space focus mode_toggle # Move focus to the parent container bindsym $mod+a focus parent # # Scratchpad: # # Sway has a "scratchpad", which is a bag of holding for windows. # You can send windows there and get them back later. # Move the currently focused window to the scratchpad bindsym $mod+Shift+minus move scratchpad # Show the next scratchpad window or hide the focused scratchpad window. # If there are multiple scratchpad windows, this command cycles through them. bindsym $mod+minus scratchpad show # # Resizing containers: # mode "resize" { # left will shrink the containers width # right will grow the containers width # up will shrink the containers height # down will grow the containers height bindsym $left resize shrink width 10px bindsym $down resize grow height 10px bindsym $up resize shrink height 10px bindsym $right resize grow width 10px # Ditto, with arrow keys bindsym Left resize shrink width 10px bindsym Down resize grow height 10px bindsym Up resize shrink height 10px bindsym Right resize grow width 10px # Return to default mode bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+r mode "resize" # # Status Bar: # # Read `man 5 sway-bar` for more information about this section. bar { position top # When the status_command prints a new line to stdout, swaybar updates. # The default just shows the current date and time. status_command while true; do $HOME/bin/sway_bar.sh; sleep 1; done colors { statusline #ffffff background #323232 inactive_workspace #32323200 #32323200 #5c5c5c } } # volume / brightness / media controls bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle bindsym XF86MonBrightnessDown exec light -U 5% bindsym XF86MonBrightnessUp exec light -A 5% # Screenshotting # Taken from: https://llandy3d.github.io/sway-on-ubuntu/extra/#screenshots bindsym Print exec grimshot --notify save screen bindsym Ctrl+Print exec grimshot --notify copy screen bindsym Shift+Print exec grimshot --notify save area bindsym Ctrl+Shift+Print exec grimshot --notify copy area # Mako # Taken from: https://llandy3d.github.io/sway-on-ubuntu/extra/#notification-manager-mako bindsym $mod+n exec makoctl dismiss bindsym $mod+Shift+n exec makoctl dismiss -a # Start programs exec mako include /etc/sway/config.d/* == Battery Display functions for .bashrc== function battery_percentage() { current=$(cat /sys/class/power_supply/BAT0/charge_now) base=$(cat /sys/class/power_supply/BAT0/charge_full) percentage=$(( $current / $base )) if (command -v bc > /dev/null 2>&1); then result=$(echo "scale=2; ${current} / ${base} * 100" | bc) echo -n $result fi } # Emojified battery display function battery_percentage_display-color() { result=$(battery_percentage) bold="\x01$(tput bold)\x02" reset="\x01$(tput sgr0)\x02" blink="\x01$(tput blink)\x02" if(($(tput colors)==256)); then red="\x01$(tput setaf 124)\x02" green="\x01$(tput setaf 034)\x02" yellow="\x01$(tput setaf 220)\x02" live_battery="\x01\xf0\x9f\x94\x8b\x02\x08" low_battery="\x01\xf0\x9f\xaa\xab\x02\x08" if [ -n "$result" ]; then case "$result" in 100*|9*) echo -ne "[ ${live_battery} ${green}${bold} ${result}% \x01${reset}\x02${live_battery} ]";; [5-8][0-9]*) echo -ne "[ ${green}${result}% \x01${reset}\x02]";; [4-9].00) echo -ne "[ ${red}${bold} ${result}%\x01${reset}\x02 ]";; 1.00|2.00|3.00) echo -ne "[\x01${blink}\x02${low_battery} \x01${reset}\x02 ${red}${bold}\x01${result}\x02% \x01${blink}\x02${low_battery}\x01${reset}\x02 ]";; [34]*) echo -ne "[ ${yellow}${bold}${result}%\x01${reset}\x02 ]";; 2[0-9]) echo -ne "[ ${yellow}${result}%\x01${reset}\x02 ]";; 1*) echo -ne "[ ${red}${result}%\x01${reset}\x02 ]";; esac else echo -ne "" fi elif (($(tput colors)==8)); then red="\x01\e[0;31m\x02" b_red="\x01\e[1;31m\x02" bb_red="\x01\e[47;31m\x02" green="\x01\e[0;32m\x02" b_green="\x01\e[1;32m\x02" yellow="\x01\e[0;93m\x02" b_yellow="\x01\e[93;44m\x02" if [ -n "$result" ]; then case "$result" in 1.00|2.00|3.00) echo -ne "[ \x01${bb_red}\x02${result}%${reset} ]";; [4-9].00) echo -ne "[ \x01${b_red}\x02${result}%${reset} ]";; 1*) echo -ne "[ \x01${red}\x02${result}%${reset} ]";; 2*) echo -ne "[ \x01${yellow}\x02${result}%${reset} ]";; [34]*) echo -ne "[ \x01${b_yellow}\x02${result}%${reset} ]";; [5-8][0-9]*) echo -ne "[ \x01${green}\x02${result}%${reset} ]";; 9*|100*) echo -ne "[ \x01${b_green}\x02${result}%${reset} ]";; esac else echo -ne "" fi fi } if [ "$color_prompt" = yes ]; then # We set this string to ' b/c it will be evaluated by the shell later PS1='${debian_chroot:+($debian_chroot)}\001$(battery_percentage_display-color)\002 \u@\h:\w\$ ' else PS1="${debian_chroot:+($debian_chroot)}[$(battery_percentage_display)%] \u@\h:\w\$ " fi == Font Utilities == fc-cache --verbose: Update the font cache. By default, it recursively searches ~/.local/share/fonts/ and /usr/share/fonts/. fc-list: Look through the font list to make sure all your fonts are detected. Emojis in foot https://codeberg.org/dnkl/foot/wiki#user-content-how-do-i-get-colored-emojis Font with emojis: https://packages.debian.org/buster/fonts-noto-color-emoji = Troubleshooting = == Lotta System Info == inxi -Fxz; for focused battery information check out: `/sys/class/power_supply/BAT*/*` : by itself it will get you CPU/Kernel/Storage
Footnotes
- Look, planned obsolescence has a real cost and the relentless nag to buy new electronics for dubious benefits (“Faster!” “More!”) has a substantive, measurable impact on the planet’s resource use and incentivizes bad behavior in authoritarian regimes.