User Tools

Site Tools


linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux [2023/11/07 22:54] dblumelinux [2024/04/27 00:13] (current) dblume
Line 11: Line 11:
   sudo apt install exuberant-ctags cscope moreutils   sudo apt install exuberant-ctags cscope moreutils
    
-Now that you have vim and git:+Now that you have vim and git, get [[https://github.com/dblume/dotfiles|your dotfiles]]:
      
   git clone ssh://dblume@dlma.com/~/git/dotfiles.git   git clone ssh://dblume@dlma.com/~/git/dotfiles.git
Line 21: Line 21:
   sudo apt install tmux entr   sudo apt install tmux entr
   tmux   tmux
-  sudo apt install curl jq tree expect gnuplot httpie visidata+  sudo apt install curl jq tree expect gnuplot httpie visidata ripgrep at
   sudo apt install python3-pip   sudo apt install python3-pip
   python3 -m pip install matplotlib   python3 -m pip install matplotlib
Line 47: Line 47:
 User pic: [[https://dlma.com/avatars/magicavoxel_avatar_for_circular_apertures.png|magicavoxel_avatar_for_circular_apertures.png]] User pic: [[https://dlma.com/avatars/magicavoxel_avatar_for_circular_apertures.png|magicavoxel_avatar_for_circular_apertures.png]]
  
-===== Learn Shortcuts =====+===== Google Chrome Passwords and Autofill =====
  
-Consider vim leader (\), vim window (C-w), tmux leader (C-a)...+Via an [[https://unix.stackexchange.com/a/606531|answer to "chrome does not save my passwords"]]:
  
-How to change workspaces? (Ctrl+Alt <- or ->)+> Sometimes a couple of login files get corrupt, and stop google-chrome from saving the passwords. To fix it, close google-chrome. Terminal to the following directory and remove the two files, Login Data and Login Data-journal. 
 + 
 +  cd ~/.config/google-chrome/Default 
 +  rm 'Login Data' 
 +  rm 'Login Data-journal' 
 + 
 + 
 +===== Image/Photo Editors ===== 
 + 
 +Seems like I'm going to be preferring pixlr (online) or Krita (local). 
 + 
 +^ App ^ Online ^ Notes ^ 
 +-> **[[https://pixlr.com/|pixlr]]** | Online | Good  image editor. Pretty intuitive. No arrows. | 
 +| [[https://www.photopea.com/|Photopea]] | Online | Has arrows. Width is limited to a narrow max. | 
 +| [[https://excalidraw.com/|Excalidraw]] | Online | Pretty great diagram drawing tools. Not a photo editor, but making a note here. | 
 +| **-> [[https://krita.org/en/|Krita]]** | Local | Promising image editor. Arrows in vector layer. Draw line then change properties. | 
 +| [[https://www.gimp.org/|Gimp]] | Local | The huge standard. GNU Photoshop. More than I usually need. | 
 +| [[https://www.pinta-project.com/|Pinta]] | Local | Inspired by an old version of Paint.NET. Installed, but unsure. Arrows are easy. | 
 + 
 + 
 +After installing Krita, add a desktop launcher to make it more GNOME/rofi/drun friendly. [[https://amanabt.github.io/blog/tech/2022/03/11/installing-krita-from-appimage-ubuntu-20_04.html|Extract the .desktop from the appimage]] to $HOME/.local/share/applications or manually make a [[https://github.com/davatorium/rofi/issues/326#issuecomment-174301525|.desktop file]] in $HOME/.local/share/applications. 
 + 
 +I put the krita appimage in ''/usr/local/bin'', the .desktop in ''$HOME/.local/share/applications'', and a 256x256 .png in ''/usr/share/pixmaps''. The .png is untested. 
 + 
 +===== DejaVu Sans for Powerline Font ===== 
 + 
 +First install the Powerline Font: 
 + 
 +  git clone --filter=blob:none -b master --single-branch https://github.com/powerline/fonts.git 
 +  cd fonts 
 +  ./install.sh "DejaVu Sans" 
 + 
 +Then your terminal emulator can use it.
  
 ===== i3 ===== ===== i3 =====
Line 57: Line 89:
 The [[https://i3wm.org/|i3 Window Manager]]. The [[https://i3wm.org/|i3 Window Manager]].
  
-==== Configuration ====+==== Install Alacritty ====
  
-[[https://major.io/p/tray-icons-in-i3/|Enable touchpad tap to click in i3]].+gnome-terminal won't distinguish between C-i and Tab, so [[https://www.how2shout.com/linux/how-to-install-alacritty-terminal-on-ubuntu-22-04-lts/|install a terminal emulator that can, like Alacritty]], and set TERMINAL in .bashrc for i3-sensible-terminal to use. 
 + 
 + 
 +==== Configuration ====
  
 <file bash .config/i3/config> <file bash .config/i3/config>
Line 66: Line 101:
 # bindsym all the jkl; to hjkl # bindsym all the jkl; to hjkl
  
-# `xinput` to find the name of the Touchpad (the id can change) 
-# `xinput list-props "PIXA3854:00 093A:0274 Touchpad"` to see properties 
 exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --color 101030 --nofork exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --color 101030 --nofork
 +</file>
  
-exec xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Tapping Enabled" 1 +[[https://major.io/p/tray-icons-in-i3/|Enable touchpad tap to click in i3]]. 
-exec xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Natural Scrolling Enabled" 1 +''xinput'' to find the name of the Touchpad (the id can change) 
-exec xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Tapping Drag Lock Enabled" 1+''xinput list-props "PIXA3854:00 093A:0274 Touchpad"'' to see properties
  
 +<file bash .xsessionrc>
 +xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Tapping Enabled" 1
 +xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Natural Scrolling Enabled" 1
 +xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Tapping Drag Lock Enabled" 1
 +xinput set-prop "PIXA3854:00 093A:0274 Touchpad" "libinput Scrolling Pixel Distance" 40
 </file> </file>
  
-I have the [[https://www.reddit.com/r/linuxmasterrace/comments/4usryc/i3_ui_and_text_ridiculously_tiny_on_fresh_arch/|ridiculously tiny font]] problem where a commenter suggests "set the DPI in your xorg.conf"[[https://linuxreviews.org/HOWTO_set_DPI_in_Xorg|HOWTO set DPI in Xorg]].+From [[https://wiki.archlinux.org/title/HiDPI#X_Resources|HiDPI -> X Resources]]: (96dpi * 1.5 = 144dpi) 
 +<file bash .Xresources> 
 +Xft.dpi144 
 +</file>
  
-Maybe [[https://wiki.archlinux.org/title/HiDPI#X_Resources|HiDPI -> X Resources]]'s ''Xft.dpi'' setting will help.+Enable Brightness Keys, Media keys, background image: 
 + 
 +  sudo apt install brightnessctl playerctl feh 
 +  sudo usermod -a -G video ${USER} 
 +  # Logout and log back in 
 + 
 +Enable screenshots with maim and xclip 
 + 
 +  sudo apt install maim xclip 
 + 
 +I have the [[https://www.reddit.com/r/linuxmasterrace/comments/4usryc/i3_ui_and_text_ridiculously_tiny_on_fresh_arch/|ridiculously tiny font]] problem where a commenter suggests "set the DPI in your xorg.conf". [[https://linuxreviews.org/HOWTO_set_DPI_in_Xorg|HOWTO set DPI in Xorg]].
  
 The tiny Wi-Fi connection dialog is [[https://wiki.archlinux.org/title/Dunst|Dunst]] which has its own config [[https://www.reddit.com/r/i3wm/comments/b1s18p/how_do_you_change_the_default_font_size_of/|reddit thread]]. The tiny Wi-Fi connection dialog is [[https://wiki.archlinux.org/title/Dunst|Dunst]] which has its own config [[https://www.reddit.com/r/i3wm/comments/b1s18p/how_do_you_change_the_default_font_size_of/|reddit thread]].
  
-===== Gnome (Desktop Env) Usability Issues =====+I thought the media keys (Function keys) weren't working. I added "blacklist hid_sensor_hub" to [[https://community.frame.work/t/solved-guide-12th-gen-not-sending-xf86monbrightnessup-down/20605|framework-als-blacklist.conf]] for the brightness keys. (But I should undo that change and see if they still work now. Make sure the "fn" key wasn't in the other mode.) 
 + 
 +<file bash> 
 +  sudo vim /etc/modprobe.d/framework-als-blacklist.conf 
 +</file> 
 +Test with 
 + 
 +  pactl set-sink-volume @DEFAULT_SINK@ +10% 
 +  pactl get-sink-volume @DEFAULT_SINK@ 
 +  speaker-test -t wav -c 6 
 + 
 +==== Terminal Configuration ==== 
 + 
 +Get rid of the Gnome Terminal Window bar: 
 + 
 +  $ gsettings set org.gnome.Terminal.Legacy.Settings headerbar false 
 +  
 +Get rid of the menubar: 
 + 
 +"Right Click for context menu" -> Preferences -> General -> Show menubar by default in new terminals 
 + 
 +Or, try this to get rid of the menubar 
 + 
 +<file bash .config/gtk-3.0/settings.ini> 
 +gtk-decoration-layout=:menu 
 +</file> 
 + 
 +==== Wi-Fi and Network Management ==== 
 + 
 +GUI: "Advanced Network Configuration" 
 + 
 +    nm-connection-editor & 
 + 
 +CLI: 
 + 
 +    nmtui 
 + 
 +==== Suspend and Hibernation ==== 
 + 
 +A note on battery life. Frame.work batteries work best at charges between 80% and 30%. I went into BIOS ([[https://knowledgebase.frame.work/how-do-i-enter-the-bios-on-the-framework-laptop-HydmWf5Ad|pressing F2 on start up]]) and set maximum charge to 90%. 
 + 
 +Suspend worked out of the box. See This PSA from frame.work: [[https://www.reddit.com/r/framework/comments/19bf3ki/linux_suspend_and_amd_reminder/|Linux Suspend and AMD Reminder]]. Per that PSA and [[https://community.frame.work/t/tracking-linux-battery-life-tuning/6665/536|[TRACKING] Linux Battery Life tuning]], I ran [[https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py?ref_type=heads|amd_s2idle.py]]. It ended with: 
 +<code> 
 +🚦 RTC driver `rtc_cmos` configured to use ACPI alarm 
 +Explanations for your system 
 +🚦 rtc_cmos is not configured to use ACPI alarm 
 + Some problems can occur during wakeup cycles if the HPET RTC emulation is used to 
 + wake systems. This can manifest in unexpected wakeups or high power consumption. 
 + 
 +For more information on this failure see: 
 + https://github.com/systemd/systemd/issues/24279 
 +</code> 
 +So per the third link above, I [[https://askubuntu.com/questions/19486/how-do-i-add-a-kernel-boot-parameter|added a kernel boot parameter]] by editing /etc/default/grub like so: 
 +<file bash /etc/default/grub> 
 +... 
 +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rtc_cmos.use_acpi_alarm=1" 
 +... 
 +</file> 
 +And then I ran ''sudo update-grub'' per the file's instructions. 
 + 
 +Enable suspend-then-hibernate. To hibernate, [[https://community.frame.work/t/hibernation-using-it/6060/11|you need swap to be as big as RAM, then update GRUB]]. (32GiB in my case.) You may also have to [[https://community.frame.work/t/battery-drain-on-suspend-sleep-with-linux/42395/4?u=david_blume|disable Secure Boot]]. 
 + 
 +I had a 2GiB /swapfile, and this is how I resized it: 
 +<code bash> 
 +~$ sudo swapoff /swapfile  
 +~$ sudo dd if=/dev/zero of=/swapfile count=32K bs=1M 
 +... 
 +~$ sudo mkswap /swapfile  
 +~$ sudo swapon /swapfile 
 +</code> 
 +Then it became time to update the kernel boot params again with the UUID of the volume with the swapfile, and the physical offset of the swapfile. 
 +<code bash> 
 +$ blkid 
 +/dev/nvme0n1p2: UUID="de9f6aca-85a1-461b-b8b8-15f44441f64d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="121db783-104a-4138-b7c2-c0451ab10454" 
 + 
 +$ sudo filefrag -v /swapfile | head 
 +Filesystem type is: ef53 
 +File size of /swapfile is 34359738368 (8388608 blocks of 4096 bytes) 
 + ext:     logical_offset:        physical_offset: length:   expected: flags: 
 +   0:        0..    2047:    1257472..   1259519:   2048:             
 +</code> 
 +That means, in my case, I add this to ''/etc/default/grub'''s ''GRUB_CMDLINE_LINUX_DEFAULT''
 +<code> 
 +resume=UUID=de9f6aca-85a1-461b-b8b8-15f44441f64d resume_offset=1257472 
 +</code> 
 +Don't forget to ''sudo update-grub''
 + 
 +Then I enabled this line in  
 +<file bash /etc/systemd/logind.conf>    
 +HandleLidSwitch=suspend-then-hibernate 
 +</file> 
 + 
 +Everything is still commented out in ''/etc/systemd/sleep.conf'' (Also see [[https://community.frame.work/t/tracking-suspend-on-linux-drains-a-lot-of-battery-compared-to-other-laptop/24737/60|suspend drains battery]]). May need to turn some of those lines on. 
 + 
 +==== Future Config Tips ==== 
 + 
 +You can use ''xprop'' to learn the Window Class (the second value) for assigning apps to workspaces 
 + 
 +  assign[class="Rhythmbox"] $workspace10 
 + 
 + 
 +If you keep accidentally typing Ctrl+Shift+C in Chrome, [[https://askubuntu.com/questions/604434/chrome-disable-or-change-keyboard-shortcut-ctrlshiftc-developer-tools-console|you can disable it with shortkeys extension]]: 
 + 
 +Install [[https://chrome.google.com/webstore/detail/shortkeys-custom-keyboard/logpjaacgmcbpdkdchjiaagddngobkck|shortkeys]] and set (and save) the following: 
 +  * Keyboard shortcut: ctrl+shift+c 
 +  * Behavior: Run JavaScript 
 +  * Javascript code to run: ''document.execCommand('copy')'' 
 + 
 +===== Gnome (Desktop Env) =====
  
 Enable tap and drag lock: Enable tap and drag lock:
Line 95: Line 255:
 Terminal Font: 16pt Terminal Font: 16pt
 Chrome Zoom: 110% Chrome Zoom: 110%
 +
 +==== Keyboard Shortcuts ====
 +
 +^ Keys ^ Action ^
 +| Ctrl+Alt <- or -> | Change workspaces |
  
 ==== Other Questions ==== ==== Other Questions ====
linux.1699426482.txt.gz · Last modified: 2023/11/07 22:54 by dblume