i3 Window Manager

245 readers
1 users here now

About

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

Resources

founded 3 years ago
MODERATORS
1
 
 

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.

2
 
 

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?

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

I have a need to repeatedly click in a application's window many times for testing purposes at work. Since I have not 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.

4
5
submitted 1 month ago* (last edited 1 month 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.

5
 
 

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.

6
 
 

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.

7
 
 

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.

8
 
 

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.

9
 
 

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

10
 
 

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!

11
 
 

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`

12
 
 

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)

13
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ร !

14
15
16
17
 
 

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. ๐Ÿ˜Ž