Qubes i3 Tips & Tricks

1,745 views
Skip to first unread message

Daniel Moerner

unread,
Mar 6, 2017, 6:26:47 PM3/6/17
to qubes-users
I've been using i3 in dom0 for about a month now, and I wanted to share a few tips and tricks (partly so I can have them in a centralized place for reference):

1. To lock the screen on suspend and resume, you need to add a systemd target in /etc/systemd/system. This has to use your username (or supposedly xss-lock, which I haven't bothered figuring out how to use). I use the following content, substituting for $USER:

[Unit]
Description=Lock screen on suspend

[Service]
User=$USER
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock -d -c 000000

[Install]
WantedBy=suspend.target

2. Volume keys: Install pulseaudio-utils. Then put the following in .i3/config:

bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 1 +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 1 -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle

I then customize the qubes-i3status command by adding: (I know this awk/sed mixture is awful, and it's hard-coded for my system, which has two pulseaudio sinks)

status_volume() {
local muted=$(pactl list sinks | awk -F ' ' '/Mute/ {print $2}' | sed -s 's/ //g' -e '2q;d')
if [[ $muted == 'yes' ]]; then
json volume "Volume: 0%"
else
local volume=$(pactl list sinks | awk -F ' ' '/Volume/ {print $2}' | sed -s 's/ //g' -e '3q;d')
json volume "Volume: $volume"
fi
}

And then add a local volume variable to the main() call. I update every second.

3. A few minor tweaks to the config file: See this pull request, which has already been merged: https://github.com/QubesOS/qubes-desktop-linux-i3/pull/5

A few more personal thoughts: Personally, I change the navigation to use vim keys, and then remap horizontal split to 'b'. I also remap 'focus child' to 'c', since I find it to be a useful shortcut. Originally I disabled fullscreen, on the model of Xfce4, but I had to reenable it as part of a workaround for https://github.com/QubesOS/qubes-issues/issues/1502

I'm sure I'm missing a few things, but I wanted to share this, since I sometimes see people asking about i3, especially on IRC.

Best,
Daniel

sm8ax1

unread,
Mar 6, 2017, 11:02:53 PM3/6/17
to qubes...@googlegroups.com
Daniel Moerner:
Thanks for this. I've used i3 on other OSes and I like it a lot. I
probably won't use it on Qubes however because of an issue that I'll
note here since it may or may not affect other users.

In i3 it is rather difficult to control the size of a window with fine
granularity, and in particular it is very difficult to restore the exact
size a window would have been created with. This is a problem for users
of Tor Browser, because websites and exit nodes can query the browser
window's size even when you have JavaScript disabled. This makes you an
easy fingerprinting target.

If anyone knows of any workarounds for this, perhaps forcing certain
kinds of windows to be created in floating mode and keep their original
size, please share them.

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!

Daniel Moerner

unread,
Mar 7, 2017, 8:43:01 AM3/7/17
to sm8ax1, qubes-users
On Mon, Mar 6, 2017 at 11:02 PM, sm8ax1 <sm8...@vfemail.net> wrote:
> Thanks for this. I've used i3 on other OSes and I like it a lot. I
> probably won't use it on Qubes however because of an issue that I'll
> note here since it may or may not affect other users.
>
> In i3 it is rather difficult to control the size of a window with fine
> granularity, and in particular it is very difficult to restore the exact
> size a window would have been created with. This is a problem for users
> of Tor Browser, because websites and exit nodes can query the browser
> window's size even when you have JavaScript disabled. This makes you an
> easy fingerprinting target.
>
> If anyone knows of any workarounds for this, perhaps forcing certain
> kinds of windows to be created in floating mode and keep their original
> size, please share them.

You'd have to experiment with whether it keeps the windows their original size, but you can force windows to start in floating mode in .i3/config: https://faq.i3wm.org/question/61/forcing-windows-as-always-floating.1.html

A line similar to:

for_window [class="anon-whonix:[.]*"] floating enable

Should make all windows from the anon-whonix VM float by default, although I haven't tested this.

Daniel

Eva Star

unread,
Mar 7, 2017, 7:21:07 PM3/7/17
to qubes...@googlegroups.com
Can somebody share screenshots of i3&Qubes ? Thanks


--
Regards

anoa

unread,
Mar 7, 2017, 8:24:36 PM3/7/17
to qubes...@googlegroups.com
On 03/07/2017 05:42 AM, Daniel Moerner wrote:
> On Mon, Mar 6, 2017 at 11:02 PM, sm8ax1
> <sm8...@vfemail.net
> --
> You received this message because you are subscribed to the Google
> Groups "qubes-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
> qubes-users...@googlegroups.com
> <mailto:qubes-users...@googlegroups.com>.
> To post to this group, send email to
> qubes...@googlegroups.com
> <mailto:qubes...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qubes-users/CAPSgt5nbAWaR0EXRQvNG_Z_4tDx4ULfifZHYyNzRzgMUeQn3VA%40mail.gmail.com
> <https://groups.google.com/d/msgid/qubes-users/CAPSgt5nbAWaR0EXRQvNG_Z_4tDx4ULfifZHYyNzRzgMUeQn3VA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

I can confirm that the following works for keeping the Tor Browser in
it's initial default state. Might be more convenient for users using
other tools in Whonix that just the browser.

for_window [class="Tor Browser"] floating enable


signature.asc

pixel fairy

unread,
Mar 8, 2017, 6:17:02 AM3/8/17
to qubes-users, eva...@openmailbox.org
On Tuesday, March 7, 2017 at 4:21:07 PM UTC-8, Eva Star wrote:
> Can somebody share screenshots of i3&Qubes ? Thanks

https://sietse.no/i3-wm-in-qubes-os

only image i could find. hope someone here posts one. im curious too.

Alex

unread,
Mar 8, 2017, 7:24:26 AM3/8/17
to qubes...@googlegroups.com
My desktop, as of now, with a little pixelation effect here and there:
http://tinypic.com/r/296lkkn/9

A little explanation: I have 6 monitors as you can see here
http://tinypic.com/r/etd2kn/9 (here Qubes was being installed), and i3
is in tabbed mode in all of them except the rightmost bottom one.
Pre-emptive comment: yes qubes does support the Matrox C680 graphics
card I use in this setup, and without any problems. Since it's a
developer/sysadmin workstation no special gaming acceleration is needed,
but screen real estate is very much appreciated by my eyes.

In the top row you can see 3 tabs (personal-firefox, work-urxvt,
personal-keepassx): if you install i3 with qubes settings as per
official documentation you will get colored tabs; the color is the one
from the VM label. It's used also in window border, but it can't easily
be seen in tinypic (has anybody a picture sharing service to recommend
that does not scale the image? original il 3840x2048).

In the other screens you can see monodevelop running, remmina (with a
running remote desktop session to a windows 2016 server), and the Qubes
VM Manager. I hate to have it floating, so I docked it and I'm hoping
(but I know I'm not the only one) that one day we'll have it with a
"responsive" datatable layout, because that wasted area is really sad -
I'd love to be able to add columns to that table, say disk image usage
percent or network traffic, but with the current layout that would only
clutter the view.

You can see that I juxtaposed two Thunderbird instances from personal
and work in screen #6, to always have the email shitstorm situation
available at a glance. You may notice the upper rightmost screen has two
tabs; one is the VM Manager and the other is the Firefox instance with
Skype and the Slack sessions opened.

Because the Qubes VM Manager is rarley used and because the space wasted
on its window saddens me a little the active window is usually the
mentioned skype+slack firefox. I devoted the rightmost column of
monitors to "communications" (on the top one the chats, on the bottom
one the e-mails).

The leftmost column is typically used by the two main firefox instances
(personal + work) and the respective keepassx windows. The decision of
this separation has been configured in i3's config file: thunderbirds
are opened in screen #6, all windows from "chat" appVM are opened in
screen #3, all firefox windows from "work" are opened in screen #4 and
from "personal" in screen #1.

All windows are automatically configured to open in docked mode; I had
to force the floating mode for some windows:
* [instance=":Msgcompose$" class=":Thunderbird$"]
* [title="^Android Emulator"]
* [class="^teamviewer:"]
* [class=":Pidgin$"]

Yes, teamviewer has its own appVM (fedora 25 based, named "teamviewer")
and all windows from that appVM are floating because otherwise it's a
nightmare. Teamviewer for linux is a packaged teamviewer.exe+wine, so it
does not really like to have its windows stretched. I also happen to use
the Android Emulator in arm mode; it's quite slow but runs without
nested-virtualization paranoia, and given a huge amount of both RAM and
time it kinda works.

You can see the effects of floating mode in screen #1 (there's a message
composition window and no, I don't normally compose from a postmaster@,
it's for the sake of the screenshot...), in screen #2 (where I started
scrot in dom0 to take the screenshot) and in screen #3 (the pidgin
instance). Since floating windows are always on top of any docked window
I rarely use them. Note that terminals (both in dom0 and, you can't see
in the screenshot but believe me, all other appvms) have been set up
with large fonts and solarized theme to ease my eyes... xterm's default
microfont and color scheme borders on crime.

The center column of screen is general-purpose to me; I end up putting
there developer consoles, IDEs, text editors and such.

With i3 you can move the mouse at the center of any screen using the
keyboard, and focus follows the mouse; you can switch tab and move thems
with keyboard shortcuts. This takes a little to get used to, but gives
speed and predictability (no more alt-tab roulettes, nor fake focus
hints because of spurious mouse movements).

Completing the tour, I added a xrandr bash script in auto-execution in
i3's config file to make sure the screens are where I expect them to be,
and reassigned some hotkeys to move a window from one screen to another.

That's just an example of my i3 setup, since you asked for some
examples. I'd never use the tiled mode much, because I need to look at
long lines (for logs/terminals) and/or long scrolls of text (for source
code), so having to constrain either dimension would be a disadvantage
for me, but I recognize it being one of the selling points for i3.

I hope this can give an example of i3wm with Qubes; for further
questions reply to this thread and I'll try to answer...

--
Alex

signature.asc

Daniel Moerner

unread,
Jul 30, 2019, 12:14:12 PM7/30/19
to qubes-users
A quick follow-up on this:

First, I have a branch with i3 updated to 4.16.1 for testing: https://github.com/dmoerner/qubes-desktop-linux-i3/tree/4.16.1-colors. I believe it is now stable. (cf. https://github.com/QubesOS/qubes-issues/issues/5168)

Second, a nice, lightweight redshift program for dom0 is sct: https://www.umaxx.net/dl/sct-0.4.tar.gz. This is written by a few OpenBSD developers and is so simple you can audit the C code yourself before installing it in dom0. It isn't in Fedora yet, although I will get around to pushing it eventually (https://copr.fedorainfracloud.org/coprs/dmoerner/sct/).

Third, a question: Some of the icons in the domains.py and devices.py tray icons don't appear by default. They do appear if you run "xfce4-settingsd". It has something to do with populating the default icons. I haven't been able to figure out how to get it to show icons without running xfce4-settingsd. I tried some basic settings in ~/.gtkrc-2.0 and ~/.config/gtk-3.0/settings.ini, without any luck. If anyone knows how to do this, that would be nice to hear. I prefer not to use "xfce4-settingsd" since it seems to mess up some of the i3 hotkeys.

By the way, if anyone is using awesome: You might want to install i3-settings-qubes. qubes-i3-xdg-autostart is a simpler alternative to dex-autostart, and qubes-i3-sensible-terminal works great with awesome.

Best,
Daniel
Reply all
Reply to author
Forward
0 new messages