13

How could I have a workspace sliding animation in i3 on ArchLinux ?

I don't want to use a full DE, I'm right now using compton as a compositor but it only offers fade in/out when switching workspaces, I can't make it perform a sliding animation such as the one in KDE or Gnome.

I don't mind installing another compositor but I'd like to be able to do it with compton and i3 if it's possible. (I don't mind neither having to use a more low level api and code the animation myself, but I don't know where to start)


The second step would be to have a workspace switching like on MacOs (Or now also on Windows 10) where you drag your fingers on the trackpad and it switches between workspaces smoothly : if you stop draging the workspace will just pop back in place. (I'm talking about this) That would be really cool to setup on a Linux system. I'm using Libinput (and libinput gestures) but I don't know if there is such a feature.


How could I get the closest to the MacOs/Windows10 workspace switching experience with i3 on ArchLinux ?

2 Answers 2

4

This is what i have done long time ago but it probably shouldn't be done like this, it is incredibly hacky and inefficient ! :P
It basically makes a screenshot of the current screen and slide it to the side one pixel at a time. (speed depend on computers i guess.)

I have a bash script goto_to_workspace.sh that is triggered every time i change workspace with this code inside : (script take argument number as workspace number like for example : goto_to_workspace.sh 4)

WORKSPACE=$1
WKSP=`xprop -root -notype  _NET_CURRENT_DESKTOP | sed 's#.* =##'`
CURRENT_WORKSPACE=`expr 1 + $WKSP`
if [ $CURRENT_WORKSPACE -ne $WORKSPACE ]; then
    scrot -q 50 PRTSRC.jpeg
    feh PRTSRC.jpeg&
    FEH_WINDOW=$!
    #WAIT (give i3 time to switch workspace in the background)
    sleep .2
fi
slide_FEH_LEFT(){
    LONG_LINE="move left 1px"
    for i in {1..11}; do
        LONG_LINE=$LONG_LINE","$LONG_LINE
    done
    i3-msg "[class=feh] $LONG_LINE"
}
slide_FEH_RIGHT(){
    LONG_LINE="move right 1px"
    for i in {1..11}; do
        LONG_LINE=$LONG_LINE","$LONG_LINE
    done
    i3-msg "[class=feh] $LONG_LINE"
}
if [ $CURRENT_WORKSPACE -gt $WORKSPACE ]; then
    slide_FEH_RIGHT
else
    slide_FEH_LEFT
fi
#SIMPLE KILL AFTER 500ms
{ sleep .5 && kill $FEH_WINDOW; } &

EDIT : looking into the problem deeper. It is smarter to use wmctrl instead.

So the function going down can be for example : (for my 1920x1080 screen)

slide_FEH_DOWN_wmctrl(){
    FEH_ID=`wmctrl -l|grep "PRTSRC.jpeg$"|awk '{print $1}'`
    for (( c=0; c!=1100; c=c+10 )) do
        wmctrl -i -r $FEH_ID -e 1,0,$c,1920,1080
    done
}

I also tried to do something quickly with xlib (c or python) but it's less smooth than wmctrl. So if someone can do that better let us know.

EDIT2 : Of course you need feh to be sticky with for example in your i3 config :

for_window [class="feh"] floating enable, sticky enable, border pixel 0, move absolute position 0 px 0 px
2
  • 2
    EDIT -> Better to use wmctrl rather than i3-msg hack.
    – bob dylan
    Oct 25, 2019 at 11:43
  • EDIT2 -> Added i3 config for feh windows
    – bob dylan
    Oct 27, 2019 at 11:30
1

This may well be possible, although I have not found a way to achieve it.

I've used i3wm for five years. It aims to be fast, without unnecessary fluff. Citing i3wm.org: "Don’t be bloated, don’t be fancy"

Your request seems to be out of the scope of this window manager; if you truly desire smooth animations such as those seen on KDE or Gnome, then you may be better served by these.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.