Re: [qubes-users] Re: Q4.0 - rc.local doesn't run automatically in AppVMs

2018-05-02 Thread Ivan Mitev
Hey,

On 05/02/2018 12:13 PM, NaBaCo wrote:
> On 05/02/18 12:03, Ivan Mitev wrote:
>>
>>
>> On 05/02/2018 11:25 AM, NaBaCo wrote:
>>> On 05/02/18 09:52, 'awokd' via qubes-users wrote:
 On Tue, May 1, 2018 7:52 am, NaBaCo wrote:
> Hello,
> I have a simple command in /rw/config/rc.local the sets the keyboard
> layout and shortcuts. I have made the script executable, and after
> searching the internet found there's a timing problem (the system runs the
> script too early), so I've added "sleep 5" to the beginning of the script.
>  The script worked well in Q3.2, and runs well even now in Q4.0 when run
> manually from command line, yet when I start the VMs, there's no effect.
> This affects both debian-9 and fedora-26 AppVMs.
> Increasing the "sleep" time didn't help.

 Tested this in a 4.0 debian-9 AppVM by adding to rc.local "date >
 /home/user/1", chmod 755 it, and it worked first try. Might want to add
 something similar to yours to make sure it's firing, then troubleshoot
 accordingly. Also check out
 https://www.mail-archive.com/qubes-users@googlegroups.com/msg20360.html.

>>>
>>> Hey,
>>> I rebooted the VM after adding your line to rc.local, and indeed it
>>> fires up. I'm assuming that rc.local runs before X server starts up.
>>> The command I want to run is 'setxkbmap'.
>>
>> As awokd pointed, rc.local starts before the X server is active.
>>
>> A workaround is to use .desktop files, which would autostart after X.
>>
>> See this doc (which by the way should help you with what you're trying
>> to achieve with keyb layouts).
>>
>> https://github.com/Qubes-Community/Contents/blob/master/docs/localization/keyboard-multiple-layouts.md
>>
> 
> Thanks Ivan, this is going to be the doc I'll change :)
> The .desktop work-around is somewhat inelegant in my opinion - why not
> use an already integrated feature rather then working around?

IIRC I first tried to put stuff in rc.local, then found out it was
started before X. I then tried with /etc/profile.d but it worked only if
you had opened a terminal. I then settled on .desktop files in
/etc/xdg/autostart, which is also the mechanism chosen by Qubes to
autostart various things.

I'd be happy to update the doc with a "cleaner", integrated solution -
feel free to send comments. Or even better - if you can - please submit
a push request with your changes (one of the ideas behind the Qubes
Community project is to be a "staging" ground for documentation, which
could then find its way to the official Qubes documentation after enough
testing). You're most likely the first user to follow this community
doc, so feel free to send any comments - not only related to the
autostart problem.

> Either way, thank you very much!

No problem :)

> --
> NaBaCo.
> 
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/1a353790-c7d6-7ff9-3abd-1320ec6aaa71%40maa.bz.
For more options, visit https://groups.google.com/d/optout.


[qubes-users] Re: Q4.0 - rc.local doesn't run automatically in AppVMs

2018-05-02 Thread NaBaCo
On 05/02/18 12:03, Ivan Mitev wrote:
> 
> 
> On 05/02/2018 11:25 AM, NaBaCo wrote:
>> On 05/02/18 09:52, 'awokd' via qubes-users wrote:
>>> On Tue, May 1, 2018 7:52 am, NaBaCo wrote:
 Hello,
 I have a simple command in /rw/config/rc.local the sets the keyboard
 layout and shortcuts. I have made the script executable, and after
 searching the internet found there's a timing problem (the system runs the
 script too early), so I've added "sleep 5" to the beginning of the script.
  The script worked well in Q3.2, and runs well even now in Q4.0 when run
 manually from command line, yet when I start the VMs, there's no effect.
 This affects both debian-9 and fedora-26 AppVMs.
 Increasing the "sleep" time didn't help.
>>>
>>> Tested this in a 4.0 debian-9 AppVM by adding to rc.local "date >
>>> /home/user/1", chmod 755 it, and it worked first try. Might want to add
>>> something similar to yours to make sure it's firing, then troubleshoot
>>> accordingly. Also check out
>>> https://www.mail-archive.com/qubes-users@googlegroups.com/msg20360.html.
>>>
>>
>> Hey,
>> I rebooted the VM after adding your line to rc.local, and indeed it
>> fires up. I'm assuming that rc.local runs before X server starts up.
>> The command I want to run is 'setxkbmap'.
> 
> As awokd pointed, rc.local starts before the X server is active.
> 
> A workaround is to use .desktop files, which would autostart after X.
> 
> See this doc (which by the way should help you with what you're trying
> to achieve with keyb layouts).
> 
> https://github.com/Qubes-Community/Contents/blob/master/docs/localization/keyboard-multiple-layouts.md
> 

Thanks Ivan, this is going to be the doc I'll change :)
The .desktop work-around is somewhat inelegant in my opinion - why not
use an already integrated feature rather then working around?

Either way, thank you very much!
--
NaBaCo.



-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/pcbvc7%24iu4%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Q4.0 - rc.local doesn't run automatically in AppVMs

2018-05-02 Thread Ivan Mitev


On 05/02/2018 11:25 AM, NaBaCo wrote:
> On 05/02/18 09:52, 'awokd' via qubes-users wrote:
>> On Tue, May 1, 2018 7:52 am, NaBaCo wrote:
>>> Hello,
>>> I have a simple command in /rw/config/rc.local the sets the keyboard
>>> layout and shortcuts. I have made the script executable, and after
>>> searching the internet found there's a timing problem (the system runs the
>>> script too early), so I've added "sleep 5" to the beginning of the script.
>>>  The script worked well in Q3.2, and runs well even now in Q4.0 when run
>>> manually from command line, yet when I start the VMs, there's no effect.
>>> This affects both debian-9 and fedora-26 AppVMs.
>>> Increasing the "sleep" time didn't help.
>>
>> Tested this in a 4.0 debian-9 AppVM by adding to rc.local "date >
>> /home/user/1", chmod 755 it, and it worked first try. Might want to add
>> something similar to yours to make sure it's firing, then troubleshoot
>> accordingly. Also check out
>> https://www.mail-archive.com/qubes-users@googlegroups.com/msg20360.html.
>>
> 
> Hey,
> I rebooted the VM after adding your line to rc.local, and indeed it
> fires up. I'm assuming that rc.local runs before X server starts up.
> The command I want to run is 'setxkbmap'.

As awokd pointed, rc.local starts before the X server is active.

A workaround is to use .desktop files, which would autostart after X.

See this doc (which by the way should help you with what you're trying
to achieve with keyb layouts).

https://github.com/Qubes-Community/Contents/blob/master/docs/localization/keyboard-multiple-layouts.md



> 
> Either way, I looked at the link you've posted and it made me think to
> look inside /etc, where I found:
> 
> (fedora-26) /etc/X11/xinit/xinitrc.d/qubes-keymap.sh
> (debian-9) /etc/X11/Xsession.d/90qubes-keyboard
> 
> From my understanding it is a script that runs automatically at X server
> start up, which parses the user's keyboard settings in
> ~/.config/qubes-keyboard-layout.rc.
> 
> The only problem was that it parses only -layout and -variant but not
> -option, so I've added that capability to the script (attached), thus
> allowing it to add custom key combinations for layout switching.
> Then I added the necessary options in
> ~/.config/qubes-keyboard-layout.rc, each separated by a + sign:
> 
> us,il,ru + ,,phonetic + grp:alt_shift_toggle
> 
> And that worked perfectly for me.
> 
> Then, after another thought, since I want the same layout configuration
> to propagate to all the VMs, I just commented out the entire script, and
> added the command I wanted in the end (last line in the attached file).
> That worked perfectly well too.
> 
> Solved!
> Thank you for your help.
> 
> --
> NaBaCo.
> 
> PS: If relevant, I'll be glad to make a PR for the script and to add
> this into the official documentation.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/027b1942-2f9b-563a-19d7-7c56bb2e11bc%40maa.bz.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Q4.0 - rc.local doesn't run automatically in AppVMs

2018-05-02 Thread 'awokd' via qubes-users
On Wed, May 2, 2018 8:25 am, NaBaCo wrote:

> I rebooted the VM after adding your line to rc.local, and indeed it
> fires up. I'm assuming that rc.local runs before X server starts up. The
> command I want to run is 'setxkbmap'.

I think rc.local runs in a different session than X, so it doesn't pick up
X-specific options/commands set within.

> Either way, I looked at the link you've posted and it made me think to
> look inside /etc, where I found:
>
> (fedora-26) /etc/X11/xinit/xinitrc.d/qubes-keymap.sh
> (debian-9) /etc/X11/Xsession.d/90qubes-keyboard
>
>
> From my understanding it is a script that runs automatically at X server
> start up, which parses the user's keyboard settings in
> ~/.config/qubes-keyboard-layout.rc.
>
>
> The only problem was that it parses only -layout and -variant but not
> -option, so I've added that capability to the script (attached), thus
> allowing it to add custom key combinations for layout switching. Then I
> added the necessary options in ~/.config/qubes-keyboard-layout.rc, each
> separated by a + sign:
>
> us,il,ru + ,,phonetic + grp:alt_shift_toggle
>
> And that worked perfectly for me.

> PS: If relevant, I'll be glad to make a PR for the script and to add
> this into the official documentation.

Sounds like that -option parsing could be helpful to other users too. I
think the developers are stretched pretty thin so you might want to ask
over on qubes-devel or just go ahead and submit the PR directly on the
Fedora & Debian scripts to see if they like the idea, then update the docs
accordingly. Glad you got it working!


-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/d3a58ffcd39527753784d2aedb335078.squirrel%40tt3j2x4k5ycaa5zt.onion.
For more options, visit https://groups.google.com/d/optout.


[qubes-users] Re: Q4.0 - rc.local doesn't run automatically in AppVMs

2018-05-02 Thread NaBaCo
On 05/02/18 09:52, 'awokd' via qubes-users wrote:
> On Tue, May 1, 2018 7:52 am, NaBaCo wrote:
>> Hello,
>> I have a simple command in /rw/config/rc.local the sets the keyboard
>> layout and shortcuts. I have made the script executable, and after
>> searching the internet found there's a timing problem (the system runs the
>> script too early), so I've added "sleep 5" to the beginning of the script.
>>  The script worked well in Q3.2, and runs well even now in Q4.0 when run
>> manually from command line, yet when I start the VMs, there's no effect.
>> This affects both debian-9 and fedora-26 AppVMs.
>> Increasing the "sleep" time didn't help.
> 
> Tested this in a 4.0 debian-9 AppVM by adding to rc.local "date >
> /home/user/1", chmod 755 it, and it worked first try. Might want to add
> something similar to yours to make sure it's firing, then troubleshoot
> accordingly. Also check out
> https://www.mail-archive.com/qubes-users@googlegroups.com/msg20360.html.
> 

Hey,
I rebooted the VM after adding your line to rc.local, and indeed it
fires up. I'm assuming that rc.local runs before X server starts up.
The command I want to run is 'setxkbmap'.

Either way, I looked at the link you've posted and it made me think to
look inside /etc, where I found:

(fedora-26) /etc/X11/xinit/xinitrc.d/qubes-keymap.sh
(debian-9) /etc/X11/Xsession.d/90qubes-keyboard

>From my understanding it is a script that runs automatically at X server
start up, which parses the user's keyboard settings in
~/.config/qubes-keyboard-layout.rc.

The only problem was that it parses only -layout and -variant but not
-option, so I've added that capability to the script (attached), thus
allowing it to add custom key combinations for layout switching.
Then I added the necessary options in
~/.config/qubes-keyboard-layout.rc, each separated by a + sign:

us,il,ru + ,,phonetic + grp:alt_shift_toggle

And that worked perfectly for me.

Then, after another thought, since I want the same layout configuration
to propagate to all the VMs, I just commented out the entire script, and
added the command I wanted in the end (last line in the attached file).
That worked perfectly well too.

Solved!
Thank you for your help.

--
NaBaCo.

PS: If relevant, I'll be glad to make a PR for the script and to add
this into the official documentation.

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/pcbshl%248g5%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


qubes-keymap.sh
Description: application/shellscript