Multimedia keys on Trisquel with i3

22 replies [Last post]
Beko
Offline
Joined: 08/31/2019

I'm using i3wm and my external keyboard's multimedia (previous,play/pause,next) keys aren't working. I tried to add

# Media player controls
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

that I found on i3 forums, but Trisquel doesn't have playerctl. I try my best not to download un-audited things straight from github

Multimedia keys however are working with MATE, so my question would be which program can I substitute for playerctl?

Thanks!

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> I'm using i3wm and my external keyboard's multimedia
> (previous,play/pause,next) keys aren't working.

> Multimedia keys however are working with MATE, so my question would be
> which program can I substitute for playerctl?

Personally, I replace MATE's default window manager (Marco) *with* i3.
That way I benefit from i3's advantages as a window manager, but sound,
USB mounting, monitor detection, etc. "just work" because MATE is still
handling those things in the background.

To try this:

(1) Set MATE's window manager to i3
$ dconf write /org/mate/desktop/session/required-components/windowmanager "'i3'"

(2) Hide desktop icons (they cause problems in i3)
$ dconf write /org/mate/desktop/background/show-desktop-icons "false"

(3) Get rid of mate-panel (assuming you only want to use i3-bar)
$ dconf write /org/mate/desktop/session/required-components/panel "''"

Then log out and log back in to MATE.

If you later decide to go back to using MATE normally, revert those
three steps:

(1)
$ dconf write /org/mate/desktop/session/required-components/windowmanager "'marco"

(2)
$ dconf write /org/mate/desktop/background/show-desktop-icons "true"

(3)
$ dconf write /org/mate/desktop/session/required-components/panel "'mate-panel'"

and log out/in again.

Beko
Offline
Joined: 08/31/2019

When putting in the first command that you gave

>(1) Set MATE's window manager to i3
$ dconf write /org/mate/desktop/session/required-components/windowmanager "'i3'"

dconf gave back an error, however, I had messed around with dconf before and I knew that there was a gui version. I opened dconf editor and went to the same directory but it had changed the window manager to i3. So I continued to change the other settings from the gui application as it was already open.

i3 is working great and all the media keys too, thank you. Very helpful responses as always Chaosmonk!

edit: Caja isn't launching, I tried to install ranger but that also doesn't run from the mod+d dmenu. Please advise :)

Beko
Offline
Joined: 08/31/2019

What file manager are you using, and how are you launching it? I've been trying for the past day but the only way that I can get a file manager to launch is through command line, which is annoying on i3 because the terminal takes up half the screen initially.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> What file manager are you using,

I alternate between ranger (a text-based file manager), nnn (better than
ranger, but I haven't fully gotten used to it), and Caja (MATE's default
file manager).

> and how are you launching it?

I use Rofi for launching graphical programs in i3, including Caja.

> I've been trying for the past day but the only way that I can get a
> file manager to launch is through command line

Does dmenu not work?

Beko
Offline
Joined: 08/31/2019

Typing caja into dmenu launches nothing, typing caja in terminal launches caja.
Typing ranger into dmenu launches nothing, typing ranger into terminal works because ranger is terminal-based (although I can't use ranger for the life of me)

I tried the Trisquel mini file manager "PCManFM" and it launches through dmenu, but I highly prefer caja so I'm going to try and install Rofi to see if I can get caja working.

Thank you

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> Typing caja into dmenu launches nothing, typing caja in terminal launches
> caja.

That reminds me, there is something weird about Caja with Rofi, which
apparently is also the case with dmenu. When I launch Caja from Rofi by
beginning to type "caja" and pressing Enter, it does not launch.
However, if instead of Enter I press Shift+Enter (which in Rofi means
"open in terminal" Caja actually launches normally.) I haven't looked
into why this is.

Beko
Offline
Joined: 08/31/2019

Yeah, I installed rofi and changed i3/config file, still caja wasn't launching. Shift + Enter did the trick!

Beko
Offline
Joined: 08/31/2019

Sorry to keep pestering you about i3, but I was wondering if you used i3-gaps? It's not in the Trisquel repo, as far as I know, and I really like the aesthetic with gaps. Functionality-wise I need nothing more from i3 really, it's simply to 'rice' out my i3 :P.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> I was wondering if you used
> i3-gaps?

Yes, that's what I use.

> It's not in the Trisquel repo, as far as I know, and I really
> like the aesthetic with gaps.

Last time I checked the way best way to install i3-gaps on Trisquel 8
was to compile it from source.

# get dependencies
sudo add-apt-repository ppa:aguignard/ppa
sudo apt update
sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev
libxcb-util0-dev libxcb-icccm4-dev libyajl-dev
libstartup-notification0-dev libxcb-randr0-dev libev-dev
libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev
libxkbcommon-x11-dev autoconf libxcb-xrm-dev

# clone and build
sudo apt install git
cd /tmp
git clone https://www.github.com/Airblader/i3 i3-gaps
cd i3-gaps
autoreconf --force --install
rm -rf build/
mkdir -p build && cd build/
../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
make
sudo make install
rm -rf i3-gaps

i3-gaps overwrites i3, so you you'll just need to log in/out.

> Functionality-wise I need nothing more from
> i3 really, it's simply to 'rice' out my i3 :P.

Let's see a screenshot when you're done :)

https://trisquel.info/en/forum/share-your-desktop-again

Beko
Offline
Joined: 08/31/2019

I installed all of the dependencies one by one (copying all at once didn't seem to want to work), even checked them twice, no problem. Got the clone in /tmp , cd into i3-gaps and autoreconf --force --install also no problem. I removed build dir and remake, also no problem. on the ../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers I got an error at the end

configure: error: Package requirements (xcb xcb-xkb xcb-xinerama xcb-randr xcb-shape) were not met:

No package 'xcb-shape' found

I double checked the dependencies you listed, all of them definitely installed. Checked each individually, 0 upgraded 0 installed 0 to remove.

full log below:

behmen@Taurinus:/tmp/i3-gaps/build$ ../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for gawk... (cached) gawk
checking for GNU make... make
checking for a sed that does not truncate output... /bin/sed
checking whether to build with code coverage support... no
checking whether to enable debugging... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for ssize_t... yes
checking for pid_t... (cached) yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking whether lstat correctly handles trailing slash... yes
checking for working strnlen... yes
checking for atexit... yes
checking for dup2... yes
checking for ftruncate... yes
checking for getcwd... yes
checking for gettimeofday... yes
checking for localtime_r... yes
checking for memchr... yes
checking for memset... yes
checking for mkdir... yes
checking for rmdir... yes
checking for setlocale... yes
checking for socket... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strndup... yes
checking for strrchr... yes
checking for strspn... yes
checking for strstr... yes
checking for strtol... yes
checking for strtoul... yes
checking for library containing floor... -lm
checking for library containing ev_run... -lev
checking for library containing shm_open... -lrt
checking for library containing iconv_open... none required
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBSN... yes
checking for XCB... no
configure: error: Package requirements (xcb xcb-xkb xcb-xinerama xcb-randr xcb-shape) were not met:

No package 'xcb-shape' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables XCB_CFLAGS
and XCB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
behmen@Taurinus:/tmp/i3-gaps/build$

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> configure: error: Package requirements (xcb xcb-xkb xcb-xinerama
> xcb-randr xcb-shape) were not met:
>
> No package 'xcb-shape' found

Hm. Try

$ sudo apt install libxcb-shape0-dev

Beko
Offline
Joined: 08/31/2019

That did it :) I copy pasted the default options for making gaps in/out +/- and all is working well! Might take me a week or two to get the setup to a point where I'm satisfied, but I'll be sure to post on the share your desktop thread.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> That did it :) I copy pasted the default options for making gaps in/out
> +/- and all is working well! Might take me a week or two to get the setup
> to a point where I'm satisfied, but I'll be sure to post on the share
> your desktop thread.

If you haven't already, you might want to set up compton as a
compositor. If you are experiencing any screen tearing in i3 this should
fix it. You can also configure some cosmetic effects like opacity and
shadows. I use this fork[1] of compton which allows for some additional
animations.[2]

[1] https://github.com/BlackCapCoder/compton
[2] https://invidio.us/watch?v=eKwPkiACqF0

Beko
Offline
Joined: 08/31/2019

I am using compton already with this line in i3 config file

exec compton -f

but occasionally seeing slight visual glitches when new windows are opening/closing such as blank white areas on transparent windows for a split second.

I'll try and Make the compton fork, thanks!

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> I am using compton already with this line in i3 config file
>
> exec compton -f
>
> but occasionally seeing slight visual glitches when new

I have found compton to be a little glitchy with the default xrender
backend, but have had no problems with opengl.

Try

$ killall compton
$ compton -f --backend glx

and if that fixes the problem then change the line in your i3 config
file to

exec compton -f --backend glx

to make the change permanent.

> I'll try and Make the compton fork, thanks!

I suggest troubleshooting your current issues with compton first.

Beko
Offline
Joined: 08/31/2019

I guess I don't need the compton fork after all, the white boxes that were showing have completely disappeared and it's much smoother with opengl.

Do you know if I can keep the workspaces always showing on the i3 bar? It doesn't matter for me which bar I use i3status/i3blocks/etc.. I've been wanting to set them up in a fashion where all the workspaces would show 1-10, which I have already replaced with icons, where the active workspace is highlighted and they respect the 1-10 order.

Depending on which order that I open windows on the workspaces, sometimes mod+2 will be the fourth workspace while mod+1 will be the second. This annoys me to no end!

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> I guess I don't need the compton fork after all, the
> white boxes that were showing have completely
> disappeared and it's much smoother with opengl.

The fork is for these animations,[1] pure eye-candy, not to fix the
rendering issues. I only suggested fixing the issues before trying out
the fork so that if the fork introduced problems you could tell them
apart from the original problems. I'm opengl fixed the issue.

> Do you know if I can keep the workspaces always showing
> on the i3 bar?

No,[2] i3 doesn't support that.

> It doesn't matter for me which bar I use
> i3status/i3blocks/etc..

i3status and i3blocks don't affect i3bar's workspace buttons, just the
status information printed on the bar.

> Depending on which order that I open windows on the
> workspaces, sometimes mod+2 will be the fourth
> workspace while mod+1 will be the second.

Are you saying that you'll type mod+x and it takes you to workspace y?
I've never had that happen. Do you mean something else?

[1] https://invidio.us/watch?v=eKwPkiACqF0

[2]
https://faq.i3wm.org/question/1228/lock-workspace-to-permanent/index.html

Beko
Offline
Joined: 08/31/2019

>Are you saying that you'll type mod+x and it takes you to workspace y?
>I've never had that happen. Do you mean something else?

The mod+# takes me to the correct workspace, sorry I didn't mean that. I meant that on the bottom row, if the first application that I open is on workspace 9 (rhythmbox for me), it'll be the first workspace from the left. Then if i open the second application on workspace 4 (mail) it will be the second from the left. Lastly if I opened a terminal on workspace 2 (terminal) then it would be third from the left.

I wanted to know if I could make it order itself so that workspace 2 would be furthest left, then 4, then 9 and any other workspace that opens to fit into wherever it should be.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> The mod+# takes me to the correct workspace, sorry I didn't mean that. I
> meant that on the bottom row, if the first application that I open is on
> workspace 9 (rhythmbox for me), it'll be the first workspace from the
> left. Then if i open the second application on workspace 4 (mail) it will
> be the second from the left. Lastly if I opened a terminal on workspace
> 2 (terminal) then it would be third from the left.
>
> I wanted to know if I could make it order itself so that workspace 2
> would be furthest left, then 4, then 9 and any other workspace that opens
> to fit into wherever it should be.

Are you saying that the numbered workspaces are not represented on i3bar
in numerical order? I can't replicate this, so I think I misunderstand.

Beko
Offline
Joined: 08/31/2019

I replaced them with icons I don't know it that's affecting anything but yes they are always ordered in the way that the windows are opened, not the workspace #.

ex: I have these lines in the config file

assign [class="Rhythmbox"] $workspace9
exec rhythmbox

so that every time I restart my computer, rhythmbox opens on workspace 9 and is the first workspace on the left. So far so good, but if I open abrowser in 1, and terminal in 2 order of the workspaces are [9:Music] [1:Home] [2:Terminal].

Does this not happen for you? Depending on which order that the windows on the workspaces launch?

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> I replaced them with icons I don't know it that's
> affecting anything but yes they are always ordered in
> the way that the windows are opened, not the workspace
> #.
>
> so that every time I restart my computer, rhythmbox
> opens on workspace 9 and is the first workspace. So far
> so good, but if I open abrowser in 1, and terminal in 2
> order of the workspaces are [9:Music] [1:Home]
> [2:Terminal].

Hm. I have never tried to replace the workspace numbers with icons, so
it's possible that you're running into something I haven't encountered.

When I login, my VPN client launches on workspace 9. However, if I then
open up any workspace 1-8, all workspaces are ordered numerically, and
workspace 9 remains the rightmost workspace unless I open workspace 10
(0).

In order to confirm whether or not the replacement icons are the issue,
can you temporarily disable them and see if the issue goes away?

Beko
Offline
Joined: 08/31/2019

Icons were indeed the issue. I put corresponding "#." (eg 1.icon) before all of the icons and they got ordered like I wanted.

I guess I was just having a brain fart, I didn't think of this solution before you mentioned it.

Thanks!