![]() |
2020-01-21
, 21:25
|
|
Community Council |
Posts: 1,669 |
Thanked: 10,227 times |
Joined on Nov 2014
@ Lower Rhine
|
#12
|
![]() |
2020-01-21
, 21:52
|
Posts: 986 |
Thanked: 1,526 times |
Joined on Jul 2010
|
#13
|
nemo@sx:~$ cat /usr/lib/systemd/user/auto-start.service [Unit] Description=Auto-start stuff after lipstick Requires=lipstick.service After=lipstick.service [Service] Type=oneshot ExecStart=/usr/local/bin/autostart RemainAfterExit=yes [Install] WantedBy=user-session.target
nemo@sx:~$ ls -al /home/nemo/.config/systemd/user/auto-start.service /home/nemo/.config/systemd/user/user-session.target.wants/auto-start.service lrwxrwxrwx 1 nemo nemo 40 Jan 19 02:55 /home/nemo/.config/systemd/user/auto-start.service -> /usr/lib/systemd/user/auto-start.service lrwxrwxrwx 1 nemo nemo 40 Jan 19 02:55 /home/nemo/.config/systemd/user/user-session.target.wants/auto-start.service -> /usr/lib/systemd/user/auto-start.service
nemo@sx:~$ cat /usr/local/bin/autostart #!/bin/sh PATH=/home/nemo/bin:$PATH /home/nemo/bin/screen-daemon backup-daemon --start /home/nemo/bin/screen-daemon email-daemon --start /home/nemo/bin/screen-daemon button-monitor --start sudo cpu-enable fast aliendalvik-post-start
![]() |
2020-01-21
, 22:22
|
Posts: 1,336 |
Thanked: 3,932 times |
Joined on Jul 2010
@ Brittany, France
|
#14
|
![]() |
2020-01-21
, 22:34
|
|
Community Council |
Posts: 1,669 |
Thanked: 10,227 times |
Joined on Nov 2014
@ Lower Rhine
|
#15
|
![]() |
2020-01-22
, 00:07
|
|
Posts: 305 |
Thanked: 1,246 times |
Joined on Aug 2015
|
#16
|
cd mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS}
pkcon install rpm-build
cd ~/rpmbuild/SOURCES/ curl -LO <https://github.com/mosen/%{name}/archive/%{version}/%{name}-%{version}.tar.gz>
cd ~/rpmbuild/ tar -xvzf SOURCES/<%{name}-%{version}>.tar.gz cp <%{name}-%{version}>/rpm/*.spec SPECS/
rpmbuild -ba SPECS/<%{name}-%{version}>.spec
![]() |
2020-01-22
, 05:27
|
Posts: 986 |
Thanked: 1,526 times |
Joined on Jul 2010
|
#17
|
How to combine those sources in one script to have all keys available to assign actions too?
The Following 4 Users Say Thank You to wolke For This Useful Post: | ||
![]() |
2020-01-22
, 05:38
|
Posts: 986 |
Thanked: 1,526 times |
Joined on Jul 2010
|
#18
|
diff --git a/src/sf-button-monitor b/src/sf-button-monitor index fd08e4e..ffe8c9d 100755 --- a/src/sf-button-monitor +++ b/src/sf-button-monitor @@ -166,12 +166,14 @@ sub main(@){ my @pattern; my $lastButtonMillis = nowMillis(); open $inputDevFH, "< $INPUT_DEV"; + open $kbDevFH, "< $KEYBOARD_DEV"; my $select = IO::Select->new(); $select->add($inputDevFH); + $select->add($kbDevFH); while(1){ - my ($buttonId, $value) = readButtonEvent($inputDevFH); + my ($buttonId, $value) = readButtonEvent($select); my $now = nowMillis(); my $elapsedMillis = $now - $lastButtonMillis; @@ -212,15 +214,18 @@ sub main(@){ #blocks until a valid button press/release event and then returns it sub readButtonEvent($){ - my ($inputDevFH) = @_; + my ($select) = @_; my $byteStr; while(1){ - read $inputDevFH, $byteStr, 16; - my @bytesDec = map {ord $_} split //, $byteStr; - my $buttonId = $bytesDec[10]; - my $value = $bytesDec[12]; - if(defined $OK_BUTTON_IDS{$buttonId}){ - return ($buttonId, $value); + my @fhs = $select->can_read(); + if(@fhs > 0){ + read $fhs[0], $byteStr, 16; + my @bytesDec = map {ord $_} split //, $byteStr; + my $buttonId = $bytesDec[10]; + my $value = $bytesDec[12]; + if(defined $OK_BUTTON_IDS{$buttonId}){ + return ($buttonId, $value); + } } } }
The Following 4 Users Say Thank You to wolke For This Useful Post: | ||
![]() |
2020-01-22
, 10:54
|
Posts: 1,336 |
Thanked: 3,932 times |
Joined on Jul 2010
@ Brittany, France
|
#19
|
The Following 5 Users Say Thank You to Kabouik For This Useful Post: | ||
![]() |
2020-01-28
, 23:25
|
Posts: 986 |
Thanked: 1,526 times |
Joined on Jul 2010
|
#20
|
The Following 5 Users Say Thank You to wolke For This Useful Post: | ||
nice! are you running this as root btw, or does nemo have write perms on that brightness device? if the latter, ill happily add this as an action, and kb as a button, if it works at the same time as mine and you can test it on yours
~ teleshoes ~