Article 5QVQ2 Scripting help: listen if window exist then send F6 to wine application.

Scripting help: listen if window exist then send F6 to wine application.

by
Johannes33
from LinuxQuestions.org on (#5QVQ2)
Hi,
I run manjaro kde-plasma.
I would like to use a key combination to play/pause all my audio/media outputs.

In wine I run a program that I have to send F6 to to make it play/pause.

I think the best way is to write a script that looks if my wine app is active and then changes the media key to be sent as F6 to the program in wine.

I have a couple of questions:

1) blunt and simple: could someone help me create a script that works?

I have created a xdotool command that sends F6 to the wine program when executed in the terminal, but I have not been able to make it work reliably using xbindkeys.

here is my attempt in ~/.xbindkeysrc

Quote:
#Create a media key:
"xdotool key --clearmodifiers XF86AudioPlay"
Control + F5 + release

#send F6 to balabolka
"xdotool search --onlyvisible --name 'Balabolka.*' windowactivate key --window %@ F6"
XF86AudioPlay
2) Could you see what is wrong?

Also to get xbindkeys to start automatically I should place xbindkeys' in ~/.xinitrc before the line that starts my window manager or DE.

3) But where is that?
here is the file. I tried on line 12 but that screwed up my login screen:
Quote:
1#!/bin/bash
2#
3# ~/.xinitrc
4#
5# Executed by startx (run your window manager from here)
6
7
8userresources=$HOME/.Xresources
9usermodmap=$HOME/.Xmodmap
10sysresources=/etc/X11/xinit/.Xresources
11sysmodmap=/etc/X11/xinit/.Xmodmap
12
13DEFAULT_SESSION=startplasma-x11
14
15# merge in defaults and keymaps
16
17if [ -f $sysresources ]; then
18 xrdb -merge $sysresources
19fi
20
21if [ -f $sysmodmap ]; then
22 xmodmap $sysmodmap
23fi
24
25if [ -f "$userresources" ]; then
26 xrdb -merge "$userresources"
27fi
28
29if [ -f "$usermodmap" ]; then
30 xmodmap "$usermodmap"
31fi
32
33# start some nice programs
34
35if [ -d /etc/X11/xinit/xinitrc.d ] ; then
36 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
37 [ -x "$f" ] && . "$f"
38 done
39 unset f
40fi
41
42get_session(){
43 local dbus_args=(--sh-syntax --exit-with-session)
44 case $1 in
45 awesome) dbus_args+=(awesome) ;;
46 bspwm) dbus_args+=(bspwm-session) ;;
47 budgie) dbus_args+=(budgie-desktop) ;;
48 cinnamon) dbus_args+=(cinnamon-session) ;;
49 deepin) dbus_args+=(startdde) ;;
50 enlightenment) dbus_args+=(enlightenment_start) ;;
51 fluxbox) dbus_args+=(startfluxbox) ;;
52 gnome) dbus_args+=(gnome-session) ;;
53 i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
54 jwm) dbus_args+=(jwm) ;;
55 kde) dbus_args+=(startplasma-x11) ;;
56 lxde) dbus_args+=(startlxde) ;;
57 lxqt) dbus_args+=(lxqt-session) ;;
58 mate) dbus_args+=(mate-session) ;;
59 xfce) dbus_args+=(xfce4-session) ;;
60 openbox) dbus_args+=(openbox-session) ;;
61 *) dbus_args+=($DEFAULT_SESSION) ;;
62 esac
63
64 echo "dbus-launch ${dbus_args[*]}"
65}
66nvidia-settings --load-config-only
67exec $(get_session "$1")
latest?d=yIl2AUoC8zA latest?i=0Yfq5CqbyeA:FigI6EpXGR4:F7zBnMy latest?i=0Yfq5CqbyeA:FigI6EpXGR4:V_sGLiP latest?d=qj6IDK7rITs latest?i=0Yfq5CqbyeA:FigI6EpXGR4:gIN9vFw0Yfq5CqbyeA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments