2

Linux mvalitov-pc 4.20.17-1-MANJARO #1 SMP PREEMPT Tue Mar 19 18:07:36 UTC 2019 x86_64 GNU/Linux

I installed lxqt and kwin, and I can't find how to configure switching between desktops. In xfce, I used the command Ctrl + Alt + Left / Right. In the shortcut settings there are only commands for switching to a specific desktop, and not for swith to next/prev.

enter image description here

1 Answer 1

2

I have encountered the same issue with lxqt on Lubuntu. There the Ctrl+Alt+Left/Right hotkeys works correctly but in Ubuntu I used to change it to another hotkeys pair. So I have spent time seeking way to set them. I ended up with using xbindkeys-config app and a script from here.

To install xbindkeys-config:

sudo apt install xbindkeys-config

For running script you may need wmctrl installed:

sudo apt install wmctrl

The script failed executing NUM_WORKSPACES and NUM_COLS variables, so I just set them explicitly:

NUM_WORKSPACES=4
NUM_COLS=4

Here is my final script version:

#!/bin/bash

CMD="$1"

NUM_WORKSPACES=4
NUM_COLS=4

#NUM_WORKSPACES=`gconftool-2 --get /apps/metacity/general/num_workspaces`
#NUM_COLS=`gconftool-2 --get /apps/panel/applets/workspace_switcher_screen0/prefs/num_rows`

NUM_ROWS=`echo "$NUM_WORKSPACES / $NUM_COLS" | bc`

CURRENT_WS=`wmctrl -d | grep \* | cut -d " " -f 1`

MOVE_LEFT="- $NUM_ROWS"
MOVE_RIGHT="+ $NUM_ROWS"
MOVE_UP="-1"
MOVE_DOWN="+1"

case $CMD in

"Left" )
    NEW_WS=`echo $CURRENT_WS "-" $NUM_ROWS | bc`
    if [[ $NEW_WS -lt 0 ]]; then NEW_WS=$CURRENT_WS; fi
    ;;

"Right" )
    NEW_WS=`echo $CURRENT_WS "+" $NUM_ROWS | bc`
    if [[ $NEW_WS -ge $NUM_WORKSPACES ]]; then NEW_WS=$CURRENT_WS; fi
    ;;

"Up" )
    WS_COL=`echo $CURRENT_WS "%" $NUM_ROWS | bc`
    if [[ $WS_COL -eq 0 ]]; then
    {
        NEW_WS=$CURRENT_WS
    }
    else
    {
        NEW_WS=`echo $CURRENT_WS "- 1" | bc`
    }; fi
    ;;

"Down" )
    NEW_WS=`echo $CURRENT_WS "+ 1" | bc`
    NEW_WS_COL=`echo $NEW_WS "%" $NUM_ROWS | bc`
    if [[ $NEW_WS_COL -eq 0 ]]; then NEW_WS=$CURRENT_WS; fi
    ;;

* )
    NEW_WS=$CMD

esac

wmctrl -s $NEW_WS
3
  • Thank you for reply, @AdminBee. Yes, I checked double square brackets in terminal and it works well. And then when I run scripts by sh, if shows the 29: [[: not found error.
    – egvo
    Aug 5, 2020 at 11:06
  • @AdminBee I found that when I run the script with bash command it doesn't show the error. It seems to me that sh is not equal to bash in my system. Such a surprise for me...
    – egvo
    Aug 5, 2020 at 11:09
  • 1
    Yeah, thank you for clarification @AdminBee. I have edited my answer.
    – egvo
    Aug 5, 2020 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .