Jump to content

User:Jl2

From ArchWiki

A application list can be obtained from the sway github page

Notification daemon

Install a notification daemon e.g. mako. Add the line exec mako in your sway config.

custom statusbar

Write a script that outputs the info in one line.

for colored output, add the line

bar {
    ...
    pango_markup enabled
    ...
}

and add this function to your script:

## Availible Color shemes
Red=#FF0000
Green=#00FF00
BrownOrange=#FFDD00
Cyan=#00FFDD

colorize () {
	echo "{<}span foreground='$1'>$2{<}/span>"
}

Ignore the brackets around {<}. didn't know how to format it.

to change the font, add this option to your sway config:

bar {
    ...
    font pango:DejaVu sans 10.5
    ...
}

Screenshots

Install grimshot and add these lines to your config:

bindsym Print exec grimshot copy area
bindsym Control+Print copy active

optionally add the --notify switch.

To directly edit the screenshot with drawing or text, use flameshot instead:

bindsym --no-repeat Shift+Print exec flameshot gui

Also have a look at flameshot config.

Screen

Align screens

install wdisplay. It is a Graphical manager as seen on DEs. see https://man.archlinux.org/man/sway-output.5.en to implement it in the configs.

See below to Auto-run it automatically on plugin/plugout.

Auto-Implement Alignment

Useful for laptops that often plug in to other screens.

Install kanshi and add the exec kanshi line to your config. Also remove any Output * lines, as these can be configured below.

Edit .config/kanshi/config as following:

profile {
    output interface config
}

profile {
    output interface config
    output other_interface config
}

kanshi will pick a profile if all outputs are pressent from top to bottom.

Replace Builtin/monitor with the output of swaymsg -t get_outputs. both the model name(e.g. 'AU Optronics 0xA195 Unknown') or the interface (e.g. HDMI-A-1) can be used. First is usefull to define an option for a specific screen.

output HDMI-A-1 enable
output eDP-1 resolution 1920x1080@60Hz position 3440,760 

see https://man.archlinux.org/man/sway-output.5.en for more config options.

To test the Settings before setting, see Align Screens above.

Screen mirroring

Install wl-mirror and run it with wl-mirror screen_to_be_mirrored

Then move the window to the workspace of the external screen. This can be combined with kanshi or bound to Ctrl+Pfor laptop integration.

Get rid of a graphical DM but keep a password

DMs are pretty slow and aren't that useful. So we can "Skip" them; also the sway lock screen does look funky.

Note though that you will break any wallets that auto-unlock on login.

Create the file .config/sway/autologin and add these lines:

include .config/sway/config
exec swaylock

Install greetd (or a other autologin method) and append these lines:

[initial_session]
command = "sway --config /home/username/.config/sway/autologin"
user = "username"

and edit the command line under [session]:

command = "agreety --cmd sway"

to auto-relogin to sway, but without the swaylock.

Pacman/Paru

ILoveCandy

Get the nice PacMan progress bars as seen in Garuda linux.

Just add ILoveCandy to /etc/pacman.conf

Parallel Downloads

Significantly increases Download times for small packages:

Uncomment the relevant line in /etc/pacman.conf

Downgrading

Install downgrade from the AUR, can be used to downgrade any package.

AUR

Tons of precompiled packages. Saves you hours of compiling time. To install:

pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com
pacman-key --lsign-key FBA220DFC880C036
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'

and append this to /etc/pacman.conf:

[chaotic-aur]
Include = /etc/pacman.d/chaotic-mirrorlist

Paru

Your automated AUR manager for the rest of the AUR packages. Exists in the Chaotic-AUR repo.

Multiuser

Using the Bootloader to select the TTY to boot into

This is useful for handling multiple users which each take up their own TTY with Getty#Automatic login to virtual console. Sadly, Linux does not have a built-in way to do this, but it is not to hard to do.

The general idea is to add a cmdline arg that is read by a Systemd service that switches the TTY before Getty is initialized.

To do this, first we add and enable the Systemd service that changes the TTY:

/etc/systemd/system/set-tty.service
[Unit]
Description=Select boot TTY from kernel cmdline
DefaultDependencies=no
After=systemd-user-sessions.service getty-pre.target
Before=getty.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/set-tty.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then add the script that changes the TTY and make it executable:

/usr/local/bin/set-tty.sh
#!/bin/sh

if grep -q set_tty /proc/cmdline; then
	TTY=$(sed -n "s/.*set_tty=\([0-9]\+\).*/\1/p" /proc/cmdline)
	chvt $TTY
fi

and enable the service with systemctl enable set-tty.

Next, for each user starting from TTY2, we add an additional boot loader entry with the cmdline parameter set_tty=n.

Automatically generating the entries for systemd-boot using simple templates

For automatically keeping the boot parameters updated, we can use a Mkinitcpio post hook (make sure to make it executable):

/etc/initcpio/post/update_commandline
#!/bin/sh

for file in /boot/efi/loader/entries/*.conf.preset; do
	file=${file%.preset}
	append=$(cat $file.cmdline)
	cmdline=$(cat /etc/cmdline.d/*.conf | tr '\n' ' ')
	cp $file.preset $file
	echo options $cmdline $append >> $file
done

And then for each user, create a "template" consisting of two files, the entry without the options line, and a file with the cmdline parameter to append:

esp/loader/entries/user2.conf.preset
title  Arch Linux (User2)
efi     /EFI/Linux/arch-linux.efi
esp/loader/entries/user2.conf.cmdline
set_tty=2

Now they should be updated every time you update the initramfs!

Allowing all users to use chvt

chmod u+s /usr/bin/chvt

Mako and KDE

If mako is installed, it will override KDE's built-in notification daemon. To fix it, simply symlink the dbus service to /dev/null:

ln -s /dev/null /usr/share/dbus-1/services/fr.emersion.mako.service

As long as you manually start mako in your WM, there should be no problem.

(soon) 10 Billion ways to break windows

  • waiting a while
  • doing nothing
  • hard reboot
  • Not cleanly unmounting the ntfs partition
  • pressing the power button for a while
  • editing the partition layout