Skip to content
Snippets Groups Projects

device-nokia-n900: various fixes and improvements to the user experience in i3wm

Closed Imported Administrator requested to merge device-nokia-n900-improving-i3wm into master

These changes are aimed at minor improvements and fixes to the user interface in i3wm:

  1. Fixing WiFi signal quality in i3blocks (https://gitlab.com/DvaMishkiLapa/pmaports/-/commit/e3a9b867ae6180ce1226a5493353d6de864aa716).

    /proc/net/wireless no longer exists in the system. I don't know exactly when this happened. On my device it disappeared when I switched from kernel 5.* to 6.*. Now you can get the same information from nmcli.

  2. Added battery temperature information to i3blocks (https://gitlab.com/DvaMishkiLapa/pmaports/-/commit/e7c5eca2c345097b13256fc1a124b4f3ab1c9ac0).

    I think this is useful, so you can see at least some information about the heating of the device.

  3. Added volume control in alsamixer using the volume buttons via i3wm (https://gitlab.com/DvaMishkiLapa/pmaports/-/commit/a060096b4abe8b614e9ae11aff29f133aa4486b9).

    I tied the volume buttons to amixer set PCM 5%+ and amixer set PCM 5%-.

  4. Added hotkeys to create a screenshot with imagemagick via i3wm (https://gitlab.com/DvaMishkiLapa/pmaports/-/commit/35007eaefd0e471634c74aad9294234ceed260ae).

    I wrote a simple script screenshot.sh that uses import from imagemagick and creates a screenshot of the entire display in the Screenshot folder in the user's home directory. This script also takes as parameters a different path to save the screenshot, as well as the display number of the X server. This is tied to Shift+Ctrl+p.

  5. Added hotkeys to change the brightness of the display backlight and keypad LEDs via i3wm (https://gitlab.com/DvaMishkiLapa/pmaports/-/commit/968293603a3d55d1380fdff34d4c89d8bcd00bda).

    I have written simple scripts screen_brightness.sh and kb_brightness.sh that take as an argument the brightness intensity offset for the display and for the keyboard LEDs. Although these scripts are almost identical, I decided to separate them so that each of them would be responsible for its own function. This works through a separate mode "brightness" where w and s are responsible for the brightness of the display and e and d are responsible for the brightness of the keyboard LEDs.

Merge request reports

Approval is optional

Closed by AdministratorAdministrator 1 year ago (Jul 9, 2023 9:00pm UTC)

Merge details

  • The changes were not merged into master.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Administrator added 1 commit · Imported

    added 1 commit

    • 10cbccd9 - device-nokia-n900: scripts use tabs as indents

    Compare with previous version

    By DvaMishkiLapa on 2023-05-29T20:28:33

  • Author Owner

    @sicelo, can you have a look at this when you have the time?

    By Pablo Correa Gomez on 2023-05-29T22:26:16

  • Author Owner

    @DvaMishkiLapa nice work, thank you!

    Just a few comments:

    Fixing WiFi signal quality in i3blocks (DvaMishkiLapa/pmaports@e3a9b867).

    /proc/net/wireless no longer exists in the system. I don't know exactly when this happened. On my device it disappeared when I switched from kernel 5.* to 6.*. Now you can get the same information from nmcli.

    Thank you. I completely agree. We could restore /proc/net/wireless via kernel config, but the change is appropriate nonetheless

    Added battery temperature information to i3blocks (DvaMishkiLapa/pmaports@e7c5eca2).

    I think this is useful, so you can see at least some information about the heating of the device.

    While I do not oppose this change, I am not sure how necessary it is. In fact, I was thinking we need to shorten the information displayed on the status bar, and increase the font a little.

    Added volume control in alsamixer using the volume buttons via i3wm (DvaMishkiLapa/pmaports@a060096b).

    I tied the volume buttons to amixer set PCM 5%+ and amixer set PCM 5%-.

    Nice, thanks .

    Added hotkeys to create a screenshot with imagemagick via i3wm (DvaMishkiLapa/pmaports@35007eae).

    I wrote a simple script screenshot.sh that uses import from imagemagick and creates a screenshot of the entire display in the Screenshot folder in the user's home directory. This script also takes as parameters a different path to save the screenshot, as well as the display number of the X server. This is tied to Shift+Ctrl+p.

    You would need to also add imagemagick as a dependency for the nokia-n900 package since it is not installed by default. However, imagemagick is quite a large package. Would you consider using scrot (or some other light utility) instead?

    Also, I am not sure about the standalone script, since we don't/can't pass parameters to shortcuts. scrot command added directly in i3wm-config might be sufficient.

    Added hotkeys to change the brightness of the display backlight and keypad LEDs via i3wm (DvaMishkiLapa/pmaports@96829360).

    I have written simple scripts screen_brightness.sh and kb_brightness.sh that take as an argument the brightness intensity offset for the display and for the keyboard LEDs. Although these scripts are almost identical, I decided to separate them so that each of them would be responsible for its own function. This works through a separate mode "brightness" where w and s are responsible for the brightness of the display and e and d are responsible for the brightness of the keyboard LEDs.

    Cool. You could perhaps use the volume keys for the screen brightness in this mode? In future, especially for the keyboard LEDS, we should have them work via ambient light sensor.

    As a minor improvement on the scripts, when the value is about to be >255 or <0, you could just exit 0, thus saving a few CPU cycles of rewriting the same value to 6 keyboard LEDS

    By Sicelo on 2023-05-30T06:56:50

  • Author Owner

    @DvaMishkiLapa on a different note, perhaps you would like to also join the Testing Team?

    By Sicelo on 2023-05-30T08:10:03

    • Author Owner

      While I do not oppose this change, I am not sure how necessary it is. In fact, I was thinking we need to shorten the information displayed on the status bar, and increase the font a little.

      I had a couple of ideas about that, I'll see if I can do them. I don't know about the font, I've reduced the size of the fonts in my use case.

      You would need to also add imagemagick as a dependency for the nokia-n900 package since it is not installed by default. However, imagemagick is quite a large package. Would you consider using scrot (or some other light utility) instead?

      Yes, I agree, I didn't know about this analog, it looks lighter.

      About the dependencies, I included imagemagick as a dependency in the device-nokia-n900 package, is that not enough, or should I specify this dependency elsewhere? I thought it was logical, device-nokia-n900 includes scripts for i3wm, accordingly the dependency should be in device-nokia-n900. True, there is an exception with the shortcut for netsurf, which I didn't create. This browser is not listed anywhere as a dependency.

      Also, I am not sure about the standalone script, since we don't/can't pass parameters to shortcuts. scrot command added directly in i3wm-config might be sufficient.

      I don't really know what labels we're talking about. Passing arguments when called via exec in i3config works.

      Cool. You could perhaps use the volume keys for the screen brightness in this mode? In future, especially for the keyboard LEDS, we should have them work via ambient light sensor.

      In this case you have to create two modes in i3config. Although, I can bind volume keys and some keyboard key for that. It's hard to say how to make it more convenient.

      @DvaMishkiLapa on a different note, perhaps you would like to also join the Testing Team?

      Hmm, that sounds interesting.

      By DvaMishkiLapa on 2023-05-30T12:45:20

      Edited by Ghost User
    • Author Owner

      I had a couple of ideas about that, I'll see if I can do them. I don't know about the font, I've reduced the size of the fonts in my use case.

      I really do not think we should make font tiny for everyone. The status bar is (generally?) meant to make information easily accessible, so very small seems to defeat the purpose.

      About the dependencies, I included imagemagick as a dependency in the device-nokia-n900 package, is that not enough, or should I specify this dependency elsewhere? I thought it was logical, device-nokia-n900 includes scripts for i3wm, accordingly the dependency should be in device-nokia-n900.

      My bad. I missed that it was already added. I still think a utility with smaller install size is preferable.

      I don't really know what labels we're talking about. Passing arguments when called via exec in i3config works.

      I meant - the i3 onfig as submitted in the MR does not use feature of changing save location, or display server. Thus the script could be excluded and the actual command to tske screenshot be entered directly in i3 config.

      In this case you have to create two modes in i3config. Although, I can bind volume keys and some keyboard key for that. It's hard to say how to make it more convenient.

      Ok. Let's keep it simple. Was just an idea.

      By Sicelo on 2023-05-30T12:45:20

    • Author Owner

      While I do not oppose this change, I am not sure how necessary it is. In fact, I was thinking we need to shorten the information displayed on the status bar, and increase the font a little.

      The status bar displays information about the voltage and current capacity of the battery. I am not sure if this is useful information (especially the voltage).

      While I was thinking about removing unnecessary information from the status bar, I came to the idea that the user himself can later remove what he considers unnecessary. If he chooses i3wm as his working environment, he is able to do so. On the config side it will be possible to add/remove unnecessary sensors in the statusbar. The user won't have to look for those sensors themselves to add something new (like the same temperature).

      Although, it's hard for me to say who will use the N900 now, I do it more as a fan :D.

      By DvaMishkiLapa on 2023-05-30T15:33:42

    • Please register or sign in to reply
  • Administrator added 2 commits · Imported

    added 2 commits

    • 0ef9ffe3 - device-nokia-n900: imagemagick has been replaced by scrot
    • 186d8fab - device-nokia-n900: optimized brightness change scripts

    Compare with previous version

    By DvaMishkiLapa on 2023-05-30T17:12:44

  • Author Owner

    I have corrected the basic remarks. There is still an issue with the temperature and the status bar. I can add a commit where I removed the extra characters and also increased the font 8 -> 9.

    2023-05-30_21-42-37 It would look like this.

    By DvaMishkiLapa on 2023-05-30T19:58:36

  • Administrator
    Administrator @root started a thread on the diff
13 fi
14
15 CURRENT=`cat /sys/class/leds/lp5523\:kb1/brightness`
16 if [[ $CURRENT -eq 255 && $1 -gt 0 ]] || [[ $CURRENT -eq 0 && $1 -lt 0 ]]; then
17 echo $CURRENT
18 exit 0
19 fi
20
21 NEW_VAL=$(( $CURRENT + $1 ))
22 if [ $NEW_VAL -gt 256 ]
23 then
24 NEW_VAL=255
25 elif [ $NEW_VAL -lt 0 ]
26 then
27 NEW_VAL=0
28 fi
  • Comment on lines +22 to +28
    Author Owner

    This if block is no longer necessary

    By Sicelo on 2023-05-31T08:58:41

  • Author Owner

    A block checking whether the new value is greater than 255 or less than 0 is still needed. I cannot write numbers outside this range (lines 21-28).

    Lines 15-19 would work if the current value is already maximal, in case of an increase from the user, or minimal, in case of a decrease.

    By DvaMishkiLapa on 2023-05-31T09:46:56

  • Please register or sign in to reply
  • Administrator
    Administrator @root started a thread on the diff
  • 13 fi
    14
    15 CURRENT=`cat /sys/class/backlight/acx565akm/brightness`
    16 if [[ $CURRENT -eq 255 && $1 -gt 0 ]] || [[ $CURRENT -eq 0 && $1 -lt 0 ]]; then
    17 echo $CURRENT
    18 exit 0
    19 fi
    20
    21 NEW_VAL=$(( $CURRENT + $1 ))
    22 if [ $NEW_VAL -gt 256 ]
    23 then
    24 NEW_VAL=255
    25 elif [ $NEW_VAL -lt 0 ]
    26 then
    27 NEW_VAL=0
    28 fi
  • Administrator
    Administrator @root started a thread on the diff
  • 66 76 # Pressing the power button suspends the device
    67 77 bindsym XF86PowerOff exec --no-startup-id sudo pm-suspend
    68 78
    79 # Volume ALSA control
    80 bindsym XF86AudioRaiseVolume exec amixer set PCM 5%+
    81 bindsym XF86AudioLowerVolume exec amixer set PCM 5%-
    82
    83 # Creating a screenshot of the entire display
    84 bindsym Shift+Ctrl+p exec scrot '%Y-%m-%d_%H-%M-%S.png' -e 'mv $f ~/Screenshots'
  • Author Owner

    MR lgtm. I think you may be required to squash your commits, but I'll leave that for pmOS maintainers.

    By Sicelo on 2023-05-31T09:00:31

  • Author Owner

    You don't need to close it since it has not been rejected. Unless you have other reasons?

    By Sicelo on 2023-05-31T10:43:42

    • Author Owner

      Ah, I think I misunderstood @sicelo .

      I wanted to close because I thought there were a lot of commits to fixes on my part that came out in this MR. It's probably not the best practice, but if it's not a problem, I'll end MR.

      By DvaMishkiLapa on 2023-06-01T09:17:47

      Edited by Ghost User
    • Author Owner

      Do you mean that the MR has a lot of commits that fix your own code? You can just squash your commits and force-push the squashed ones. No need to close this MR.

      By Newbyte on 2023-06-01T09:17:47

    • Please register or sign in to reply
    • Author Owner

      @DvaMishkiLapa can we at least merge the first commit (WiFi strength fix)? It would be good to have that in stable, which is about to get released.

      I guess the easiest way is to submit it as a separate MR.

      By Sicelo on 2023-06-05T12:21:18

      Edited by Ghost User
    • Author Owner

      Yes, of course. Unfortunately, I can't find time for the rest of my MR yet. Is there anything required of me for that?

      By DvaMishkiLapa on 2023-06-05T12:21:17

    • Author Owner

      @DvaMishkiLapa seems the release is imminent, so I took the liberty, while submitting other fixes, to include a variation of your first commit above, and credited you for that work. See !4157 (diffs)

      By Sicelo on 2023-06-05T21:18:46

      Edited by Administrator
    • Please register or sign in to reply
  • Administrator mentioned in merge request !4157 (merged) · Imported

    mentioned in merge request !4157 (merged)

    By Sicelo on 2023-06-05T21:10:28

  • Administrator added status::mr-stale label · Imported

    added status::mr-stale label

  • Author Owner

    Sorry to bother you @DvaMishkiLapa,

    but we've detected that this merge request hasn't seen any recent activity. If you need help or want to discuss your approach with developers you can ping @postmarketOS. You can also ask on matrix in #devel:postmarketos.org or #postmarketos-devel on OFTC. If no further activity occurs in this MR, postmarketOS developers may close it in the future.

    Thanks for your contribution.

    By * postmarketOS Bot on 2023-07-05T22:00:04

  • Administrator closed · Imported

    closed

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading