i3 Window Manager

252 readers
5 users here now

About

Community for the i3 window manager and its popular fork i3-gaps.

Resources

founded 3 years ago
MODERATORS
1
 
 

Today I was looking for a solution how to disable the urgency hint for programs which I automatically launch in my i3 config file on startup.

I have saved the layout of my workspace number 2 (see https://i3wm.org/docs/layout-saving.html for the docs) and in my i3 config I attach that layout to workspace number 2 and I also launch some programs (applications) there. Then I let i3-msg switch to workspace 1 so I see the wallpaper. But the launched programs on workspace 2 launch just after that (I guess a few milliseconds later) so they are not focused and i3 changes the workspace color to red, which is annoying because I have to switch to workspace 2 and back to workspace 1 to get rid of the red color.

Solution: put this Bash script to your i3 config folder, in my case the full path is ~/.config/i3/urgency_off.sh and make the file executable.

#!/bin/sh
# Disable urgency hint of all opened windows on i3wm startup.
# Add it to i3 config as exec.

sleep 2

for i in $(xdotool search --class .\*)
do
	xdotool set_window --urgency 0 $i
done

Then put this line at the end of your ~/.config/i3/config file:

exec --no-startup-id ~/.config/i3/urgency_off.sh

Make sure you have xdotool installed. On Debian-based systems you can install it simply with apt install xdotool. If you use Wayland instead of X you may need to use another tool.

2
 
 

This problem is rather obscure but I'll leave the solution here in case someone else runs into it and struggles to understand what's going on.

If you use Blender with a mouse that doesn't have a 3rd button, you can use either Alt or what Blender calls "OS-Key" to navigate: set it in Preferences ▶ Input ▶ Mouse ▶ Emulate 3 Button Mouse in Blender.

OS-Key is typically the Windows / Super key on a PC, or the ⌘ Command key on a Mac. In other words, for most of us, it's the magic i3 key.

Alt works fine. The problem comes if you want to use OS-Key instead in Blender and you have floating_modifier $mod defined in your ~/.config/i3/config file: Blender3 doesn't seem to mind sharing the key with i3, but Blender4 does.

If OS-Key doesn't work in Blender, try assigning floating_modifier to some other key, like Alt for example, like so:

floating_modifier $Mod1

3
5
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 
 

I've been having some problem lately with windows "shrinking". They get a wide empty inner border when not in focus, but only if they are not the only window on the workspace, or otherwise maximized (i.e. in a tabbed parent that takes the whole workspace).

It only happens in i3. I also tested it in gnome and apps don't do that.

Examples (I'm using Evince here, but I've seen it happen with Firefox, Thunderbird and others)

Only window on workspace:

Multiple windows on workspace, unfocused. Note the inner border:

Multiple windows, focused:

I know it's not necessarily i3's fault, but any ideas on what could be the culprit?

4
 
 

This is a HOW TO, not a question :-)

Binding numeric keys (for example KP_1 or KP_0) is not as easy as it might seem. A simple bindsym $mod+KP_1 does NOT work in X11 (but maybe it works in Wayland?).

Solution

for example to define a key binding to switch to workspace 1 we can use: bindsym $mod+Mod2+KP_1 workspace number $ws1

Background info: Mod2 specifies the numlock key (although xev reports it's called Num_Lock with code 77). Mod2 is not a key to be pressed, it seems to be the numlock state, so +Mod2 means the keybinding is active with num_lock enabled.

5
 
 

If you use the Flameshot screenshot capture and annotation utility, you might have noticed that the Choose an app to open the capture (or Ctrl-O) option doesn't work right: something flashes quickly on the screen but nothing happens.

That's Flameshot throwing a fit because it can't open a popup window with the size it wants in i3. So to make this option work, let it 🙂

Add this line to your .config/i3/config:

for_window [class="flameshot"] floating enable

As a bonus, it also makes the configuration screen look better.

6
 
 

Before I open an issue, I'd like to know if anybody has encountered and solved this issue:

I want certain applications to open in a particular workspaces so naturally I have lines such as these in my ~/.config/i3/config file:

assign [title="^.*LibreWolf.*$"] $ws1
assign [class="org.remmina.Remmina"] $ws2                         
assign [title="^.*Thunderbird.*$"] $ws4
assign [class="Signal"] $ws4
assign [title="^.*ssh tunnels.*$"] $ws5

This works fine for windowed applications, but it doesn't work for fullscreen ones. For example, if I have those two lines:

assign [title="Xephyr"] $ws3                                                     
assign [title="feh"] $ws3                                                        

and I start Xephyr or feh fullscreen with Xephyr :1 -fullscreen or feh -F, they will start fullscreen in whichever workspace I happen to be and won't be moved to workspace 3.

I did find a workaround by creating a .desktop file in which the command explicitely switches to the workspace I want to use the corresponding application in before invoking the command. For example for Xephyr, I made this .local/share/applications/Xephyr.desktop file:

Name=Xephyr
Exec=bash -c "i3-msg workspace 3; Xephyr :1 -fullscreen -reset -terminate -query localhost"
Comment=
Terminal=false
Icon=xorg.png
Type=Application

It works but it's really dirty and it's not great.

Does anybody know if there's a way to convince i3 to start a fullscreen app in the correct workspace cleanly without resorting to hacks like that?

7
4
Mouse click autorepeat (lemmy.sdf.org)
submitted 4 months ago* (last edited 1 month ago) by [email protected] to c/[email protected]
 
 

I have a need to repeatedly click in an application's window many times for testing purposes at work. Since I have no intention of doing that manually and developing RSI, I set up i3 to automate this for me.

You may find this useful too - for gaming, for instance.

Setup:

  • Install xdotool

  • Create a Bash script called start_stop_autoclick.shsomewhere (I have a ~/scripts directory in my home directory for that purpose):

    #!/bin/bash
    
    DELAY=$1
    BUTTON=$2
    CMD=xdotool
    ARGS="click --delay $DELAY --repeat 99999999999999999 $BUTTON"
    
    PID=$(ps -C $CMD -o pid,cmd | awk "/$ARGS/ {print \$1}")
    if [ "$PID" ]; then
      kill $PID
    else
      $CMD $ARGS
    fi
    
  • Edit ~/.config/i3/config and add the following lines:

    # Start / stop autoclick
    
    bindsym $mod+Ctrl+button1 --whole-window exec --no-startup-id /bin/bash ~/scripts/start_stop_autoclick.sh 250 1
    bindsym $mod+Ctrl+button2 --whole-window exec --no-startup-id  bin/bash ~/scripts/start_stop_autoclick.sh 250 2
    bindsym $mod+Ctrl+button3 --whole-window exec --no-startup-id /bin/bash ~/scripts/start_stop_autoclick.sh 250 3
    

How to use it:

Hover over the button or element you want to click on repeatedly then press Ctrl+Meta and click with the button you want to autorepeat.

Be careful not to move the mouse otherwise it'll start autoclicking where you don't want and possibly wreak havoc in your windows.

To stop it, simply hit Ctrl+Meta until it stops.

How to modify it to suit your needs:

The three lines above in ~/.config/i3/config enable autoclicking on the left, right and middle buttons. If you only want it on one button, ditch the lines you don't need.

By default, they autoclick with a delay of 250 ms between clicks (i.e. 4 times per second). If you need it to click slower or faster, change the value of 250 to the delay you need.

And of course, change the key modifiers to whatever you want if Ctrl+Meta doesn't work for you.

8
5
submitted 4 months ago* (last edited 4 months ago) by [email protected] to c/[email protected]
 
 

If you need to run commands as root regularly with Rofi, you may find this useful.

So let's say you want to run usb-creator-gtk to create a bootable USB stick. You have write access to the USB stick's block device but it's not enough: you need to become root.

You can of course open a terminal and run sudo usb-creator-gtk. But it's kind of tedious if you need to do that more than once.

If you want to permanently run that command as root, do this:

  • sudo visudo to edit the /etc/sudoers file.
  • Add the line yourusername ALL = NOPASSWD: /usr/bin/usb-creator-gtk
  • Confirm that you can now run the command as root without being asked your password: sudo usb-creator-gtk should pop the USB Creator window rightaway.
  • Create a desktop entry in your home directory that will override the system-wide one: cp /usr/share/applications/usb-creator-gtk.desktop ~/.local/share/applications/

That way, when Rofi looks for available applications in drun mode, it will find your local usb-creator-gtk.desktop file before the system-wide file of the same name and will use the local one and ignore the system-wide one.

If you'd like Rofi to list both, rename the one in your local directory to a different name from the system-wide one.

  • Edit ~/.local/share/applications/usb-creator-gtk.desktop:
    • Modify Exec=usb-creator-gtk to Exec=sudo usb-creator-gtk.
    • Modify Name=Startup Disk Creator to Name=Startup Disk Creator (sudo), so you know Rofi picks your local desktop file over the system-wide one, or you can tell the sudo version apart from the normal version if you want to keep both listed.

And that's it!

Start Rofi, type "startup" and the autocompletion should list "Startup Disk Creator (sudo)" - and of course, selecting it should pop the window rightaway.

9
 
 

My preference is Diodon - especially with the Add images to clipboard history option enabled. And if you enable the Application Indicator plugin, it lhappily stays as an icon in your system tray.

The perfect clipboard for i3.

10
 
 

I use Remmina all the time to access remote computers through RDP and VNC. But it's annoying in i3 to open the main window, select a profile, then close the main window to leave just the remote session window.

Remmina does have a command line option to dock into the system tray using appindicator (the -i option, i.e. "start as a tray icon") and right-clicking the icon does provide a quick access to saved profiles.

However, there's a problem with it: when the last window closes, Remmina exits instead of staying docked in the systray- Unfortunately, the Remmina folks won't fix it - and in fact plan of killing the systray icon altogether.

There's always the possibility of making a small shell script that restarts Remmina each time it closes. The problem with that approach is, it a Remmina process doesn't terminate cleanly and stays in the background for some reason (it happens, especially if i3 is closed unexpectedly) then you have to open a terminal and kill the rogue remmina process, which is kind of a pain. Not to mention, if / when Remmina stops providing a systray icon, it'll stop working.

So instead, since I use Rofi as a launcher in i3 - like most everybody I believe - and Rofi supports custom scripts, I made a small script to parse saved Remmina profiles and add them to Rofi as a special mode, to provide quick access to them.

As a bonus, when you're not using Remmina, it's not running and eating up memory for nothing.

You can find it here, along with instructions to install it:

https://github.com/Giraut/rofi_remmina_profiles_menu

Kind of trivial, but I figured I'd share it in case someone else finds it useful.

11
 
 

Here are a few bindings in my i3 config file that I find super useful (bear in mind that I use a Kensington Expert Mouse and Button8 is a suitably unusual but still easily clicked button on that trackball, so you may want to change it to something more suitable to your preferred pointing device):

# Clicking the title bar with the upper-right button closes the window (regular default binding, just different button)
bindsym --release button8 kill

# Scrolling over any window title bar controls the volume
bindsym button4 exec pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3bar
bindsym button5 exec pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3bar

[...]

bar {

        [...]

        # Clicking the empty space in the bottom bar with the upper-right button opens the launcher
        bindsym button8 exec "rofi -modi drun,run -show drun"

        # Scrolling over the empty space in the bottom bar controls the volume
        bindsym button4 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3bar
        bindsym button5 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3bar
}

I find those bindings useful because unless a window is open fullscreen - which I rarely do personally - then there's always a window title bar at the top and the bar at the bottom.

As a result, when I quickly want to lower the volume - when the missus yells at me in the middle of the night for example 🙂 - I can slam the trackball up or down and quickly scroll the volume down.

Similarly, I can move the pointer all the way down and open the launcher with my unusual trackball button, and move all the way back up and close a window by clicking on the appropriate title bar with the same button, so that I don't really have to hit the keyboard most of the time for opening and closing simple stuff.

Anyhow, I thought I'd share.

12
 
 

I still use the old - and last - official Linux .deb package for Teams and sure enough, it doesn't behave properly in i3: Teams starts and shows up in the systray but the window is fullscreen and won't close. I have to keep a workspace around just for Teams.

I suspect Electron of course. Electron doesn't integrate well with any Linux desktop environment. Just wondering if someone knows if there's a trick to make it close in i3.

13
 
 

Hello,

I have this issue where, when playing any video on VLC or MPV, screen goes black if I switch to full screen mode. Audio is playing fine, and if I go back to windowed mode, video comes back after a couple of seconds.

I tried with Dragon player (same video file) and it is working fine.

Any idea on what could be the issue ? I have a nvidia card running on proprietary drivers.

Thanks

14
 
 

Hey, im trying to config my i3status bar so that it shows the amound downloaded + uploaded /sec i cant find something on it is this possible? Thanks for your time!

15
 
 

So is it possible to configure?

Lets say I click a link on the terminal in Workspace 1 and I have Firefox Open in Workspace 2, I want to auto focus firefox in workspace 2 because I clicked the link.


Answer: focus_on_window_activation focus`

16
 
 

How do I remove the dots in my i3bar?
I made a screenshot of the dots here:
dots.png (sorry for linking to my own site, lemmy complains about image being to big for no reason)

17
3
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 
 

I was reading about that weird i3bar quirk where the tray's opacity will always be 00 when i3bar is called with transparency. Which is aesthetically cringe-worthy to look at; almost enough to want to stop using it.

A cool workaround I heard about was to create a separate bar for the tray, and then create a shortcut to display it. You can then make that bar completely opaque, or completely transparent; either way it is consistent. Regardless of aesthetics, this is also really helpful to reduce tray icon clutter.

I couldn't find any resources on how to do it, but after some finagling I got it to work.

First off, number all of your bars with unique ids.

If two separate bars with separate ids are displayed on the same monitor, the bar with the higher number displays the furthest down. In my case, I have a bar for my primary display (bar-1), and a bar for all nonprimary displays (bar-2).

My tray bar is assigned bar-3 on my primary monitor. So it appears below my primary.

note: remember to write (tray_output none) in all of your other bars.

The tray bar is assembled like so:

bar {
	id bar-3
	output primary
	position bottom

	i3bar_command i3bar -t
	binding_mode_indicator no
	mode hide
	modifier none
	workspace_buttons no

	tray_output primary
	tray_padding 1

	colors {
		background #00000000
	}
}

And it can be activated like this: bindsym $mod+t bar mode toggle bar-3

Another cool thing to do is to create a dropdown icon for the bar. Put this in your i3blocks config:

[tray_dropdown]
color=#ffffff
command=i3-msg -q 'bar mode toggle bar-3'
full_text=

Adjust for the bar id.

And voilà!

18
19
20
21
 
 

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust.

It's now my favorite. Highly customizable, with a lot of blocks by default. Theming and icons included. 😎