New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #60 (shorcuts settings on linux) #68

Merged
merged 2 commits into from Feb 18, 2018

Conversation

Projects
None yet
5 participants
@mmai
Contributor

mmai commented Feb 17, 2018

This fixes the session crashing on ubuntu 17.10 (and probably on other versions as well).

@nitzanel

This comment has been minimized.

Show comment
Hide comment
@nitzanel

nitzanel Feb 17, 2018

When running this fork i get the following error:

expected ',' or ']' to follow array element:
  ['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/,'/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/vim-anywhere/']

I think there is a problem in the sed command at line 115.

nitzanel commented on 4c6b412 Feb 17, 2018

When running this fork i get the following error:

expected ',' or ']' to follow array element:
  ['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/,'/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/vim-anywhere/']

I think there is a problem in the sed command at line 115.

This comment has been minimized.

Show comment
Hide comment
@mmai

mmai Feb 17, 2018

Owner

Oh, you are right. It's fixed, thanks

Owner

mmai replied Feb 17, 2018

Oh, you are right. It's fixed, thanks

@mmai mmai closed this Feb 17, 2018

@mmai mmai reopened this Feb 17, 2018

@cknadler

This comment has been minimized.

Show comment
Hide comment
@cknadler

cknadler Feb 17, 2018

Owner

Hey Henri,

Thanks for the PR! I'm not very familiar with sed, so line 115 throws me for a bit of a loop. Any way you can break this down / document what you're doing here so I can understand? Thanks!

Cheers,
Chris

Owner

cknadler commented Feb 17, 2018

Hey Henri,

Thanks for the PR! I'm not very familiar with sed, so line 115 throws me for a bit of a loop. Any way you can break this down / document what you're doing here so I can understand? Thanks!

Cheers,
Chris

@mmai

This comment has been minimized.

Show comment
Hide comment
@mmai

mmai Feb 17, 2018

Contributor

Hi Chris,

Thanks for this nice app

Here I use sed with the > character as a separator, for example echo "hello" | sed -e "s>ell>arp>" replaces ell by arp in hello and gives harpo.

The goal of the line is to get the current 'custom-keybindigs' configuration and to add the $kbd_path entry. So we first get the configuration with gsettings get $media_keys custom-keybindings which gives something like ['/org/gnome.../custom0', '/org/gnome/.../custom1/'] if there are some bindings, but returns @as [] if there is no binding.

There are two sed commands chained to take these two cases in account.

The first sed command manages the case when there are some bindings :
it replaces '] by ', '$kbd_path'], so ['/org/gnome.../custom0', '/org/gnome/.../custom1/'] becomes ['/org/gnome.../custom0', '/org/gnome/.../custom1/', '$kb_path']

The second one manages the case when there is no binding, it replaces @as [] by ['$kbd_path'].

The first sed command does nothing when there is no binding because there is no ' character in the original string @as [], and the second sed command does nothing when there are bindings because in this case the original string does not contain the sequence @as [] .

I hope it makes more sense,

Henri

Contributor

mmai commented Feb 17, 2018

Hi Chris,

Thanks for this nice app

Here I use sed with the > character as a separator, for example echo "hello" | sed -e "s>ell>arp>" replaces ell by arp in hello and gives harpo.

The goal of the line is to get the current 'custom-keybindigs' configuration and to add the $kbd_path entry. So we first get the configuration with gsettings get $media_keys custom-keybindings which gives something like ['/org/gnome.../custom0', '/org/gnome/.../custom1/'] if there are some bindings, but returns @as [] if there is no binding.

There are two sed commands chained to take these two cases in account.

The first sed command manages the case when there are some bindings :
it replaces '] by ', '$kbd_path'], so ['/org/gnome.../custom0', '/org/gnome/.../custom1/'] becomes ['/org/gnome.../custom0', '/org/gnome/.../custom1/', '$kb_path']

The second one manages the case when there is no binding, it replaces @as [] by ['$kbd_path'].

The first sed command does nothing when there is no binding because there is no ' character in the original string @as [], and the second sed command does nothing when there are bindings because in this case the original string does not contain the sequence @as [] .

I hope it makes more sense,

Henri

@base0x10

This comment has been minimized.

Show comment
Hide comment
@base0x10

base0x10 Feb 17, 2018

Hey, I tested the most recent version of this PR on Fedora 27 and Ubuntu 17.10 (both of which suffer from #60 which crashes gnome on startup). LGTM

base0x10 commented Feb 17, 2018

Hey, I tested the most recent version of this PR on Fedora 27 and Ubuntu 17.10 (both of which suffer from #60 which crashes gnome on startup). LGTM

@akkartik

This comment has been minimized.

Show comment
Hide comment
@akkartik

akkartik Feb 18, 2018

Hi @cknadler, while you guys go back and forth reviewing this PR, could you please add a note to the Readme that people probably shouldn't run the install script on Linux, or something like that? It'll save people a whole lot of pain, and probably spare you some bad vibes as well. You can always remove that prose once you're confident it's not going to fuck up people's window managers in strange ways.

akkartik commented Feb 18, 2018

Hi @cknadler, while you guys go back and forth reviewing this PR, could you please add a note to the Readme that people probably shouldn't run the install script on Linux, or something like that? It'll save people a whole lot of pain, and probably spare you some bad vibes as well. You can always remove that prose once you're confident it's not going to fuck up people's window managers in strange ways.

@cknadler

This comment has been minimized.

Show comment
Hide comment
@cknadler

cknadler Feb 18, 2018

Owner

@mmai Awesome, thanks Henri. I'll merge this for now. If you can accomplish the same result without shelling out to sed, I'd happily accept another pull request. I think I understand what you're doing now, but I'm afraid I'll have a tough time maintaining this if I ever need to change it.

Thanks again!

Owner

cknadler commented Feb 18, 2018

@mmai Awesome, thanks Henri. I'll merge this for now. If you can accomplish the same result without shelling out to sed, I'd happily accept another pull request. I think I understand what you're doing now, but I'm afraid I'll have a tough time maintaining this if I ever need to change it.

Thanks again!

@cknadler cknadler merged commit ac9979e into cknadler:master Feb 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment