News for hackers. Stuff that matters.
Re:i3 4.18 by Naac on Monday February 17, 2020 @03:19PM (#22350368)
For anyone here who loves i3, but has always had trouble getting full integration to work on their laptop ( sleep, screen brightness, etc. ), check out the Regolith project[0]

It's a curation of several tools combined with i3 that gives a pretty fantastic gnome/i3 experience. Similar to spacemacs and emacs.

[0] https://regolith-linux.org/

Re:i3 4.18 by reciprocornous on Monday February 17, 2020 @04:20PM (#22350890)
If you are looking for a distro with i3 preinstalled, Manjaro i3 edition is another option.

https://manjaro.org/download/#i3

Re:i3 4.18 by trenchgun on Monday February 17, 2020 @07:09PM (#22352216)
I can recommend that.
Re:i3 4.18 by tomxor on Monday February 17, 2020 @05:25PM (#22351479)
> getting full integration to work on their laptop ( sleep, screen brightness, etc. )

I managed to golf some tiny generic inline bash scripts that fit directly inside my i3 config for screen brightness and keyboard brightness using /sys/class with generic name matching and no hardcoded values. They do require an external sudoers entry for each /sys/class unfortunately but that's because they require root perms by default.

These have served me well across multiple desktops and laptops without needing to customization for each piece of hardware.

I can post if any interest...

Re:i3 4.18 by aunetx on Monday February 17, 2020 @05:31PM (#22351528)
Yup, if you can post it, it will be greatly appreciated! I honestly find it hard to configure i3, especially for brightness...
Re:i3 4.18 by tomxor on Wednesday February 19, 2020 @11:33AM (#22367076)
Sorry for delay:

In your i3config for screen and keyboard...

    bindsym XF86MonBrightnessDown exec "sys='/sys/class/backlight/*backlight';\
        bri=$(cat ${sys}/bri*); max=$(cat ${sys}/max*);\
        val=$(($bri - $max / 32)); val=$(($val < 0 ? 0 : $val));\
        echo $val | sudo tee ${sys}/bri*;"
    bindsym XF86MonBrightnessUp exec "sys='/sys/class/backlight/*backlight';\
        bri=$(cat ${sys}/bri*); max=$(cat ${sys}/max*);\
        val=$(($bri + $max / 32)); val=$(($val > $max ? $max : $val));\
        echo $val | sudo tee ${sys}/bri*;"

    bindsym XF86KbdBrightnessDown exec "sys='/sys/class/leds/*backlight';\
        bri=$(cat ${sys}/bri*); max=$(cat ${sys}/max*);\
        val=$(($bri - $max / 32)); val=$(($val < 0 ? 0 : $val));\
        echo $val | sudo tee ${sys}/bri*;"
    bindsym XF86KbdBrightnessUp exec "sys='/sys/class/leds/*backlight';\
        bri=$(cat ${sys}/bri*); max=$(cat ${sys}/max*);\
        val=$(($bri + $max / 32)); val=$(($val > $max ? $max : $val));\
        echo $val | sudo tee ${sys}/bri*;"

The only annoying things is that you will need to add NOPASSWD sudoers entries separately for:

    /usr/bin/tee /sys/class/backlight/*/brightness
and

    /usr/bin/tee /sys/class/leds/*/brightness

These are the only complex part of my i3config, it might seem a bit lengthy compared to installing xbacklight but for me that tool could only ever fake it by changing the pixels rather than the backlight (on every piece of hardware I have tried).

The nice thing about scripting /sys/class directly is that other than the permissions it is self contained and you can easily adapt above to any other stuff it presents on your particular piece of hardware.

The value 32 is the number of divisions over the range, so it should be consistent across different hardware, but you may want to adjust it to taste still.

... awaiting more golfing like a sed oneliner :P i wrote this quite a long time ago.

Re:i3 4.18 by ColanR on Thursday February 20, 2020 @09:32AM (#22375300)
> for me that tool could only ever fake it by changing the pixels rather than the backlight (on every piece of hardware I have tried)

I'm curious - I've done it both ways, scripting /sys/class and using xbacklight. On my X230 I used xbacklight, and it seemed to work fine. How would I tell if it wasn't changing the backlight itself? I'd rather use /sys/class to get it right.

Also, here's my /sys/class code - not sure where I got it, but I probably adapted something I found. I assume it works, but it's been commented out above the xbacklight version for some time. :)

  bindsym XF86MonBrightnessDown exec bctl="/sys/class/backlight/intel_backlight/brightness" && echo $((`cat $bctl`-68)) | tee $bctl
  bindsym XF86MonBrightnessUp   exec bctl="/sys/class/backlight/intel_backlight/brightness" && echo $((`cat $bctl`+68)) | tee $bctl
Re:i3 4.18 by tomxor on Thursday February 20, 2020 @03:46PM (#22378437)
> How would I tell if it wasn't changing the backlight itself?

With the exception of OLED (no idea if laptops use that stuff yet), when the LCD is fully opaque on i.e rgb 0,0,0 the backlight LED will still bleed through - Modern LCDs are much better at blocking out the LED than they used to be so it's not always obvious in a well lit room.

If you reduce the brightness to 0 with xbacklight and then sleep the computer: The display will perceptibly dimm much further as it turns off (since this guarantees the back-light is turned off). If you use sys/class method it's possible to turn the backlight completely off so that there is no perceptible difference when you sleep/poweroff the computer.

On the older LCD panels when poor contrast ratios were common it's very obvious that xbacklight is only affecting pixels. I've never seen this tool affect the actual backlight but maybe it does have that mode?

Your script is essentially using the same method although in theory it's not as portable since the path is exact and it uses a hardcoded interval, you may have to tweak both for different machines. My one uses bash path expansion that is more likely to match other path names, and derives the interval from the max value... I honestly haven't looked at the variety of possible paths for /sys/class/backlight and max values so maybe I was over anticipating when i wrote this.

Re:i3 4.18 by ColanR on Saturday February 22, 2020 @05:04PM (#22393639)
Interesting. Thanks for the explanation. And I agree, my script isn't that flexible. I believe that " | tee" was left in there from when I tried to skip the sudoers entry...it's definitely not pretty.
Re:i3 4.18 by dpbriggs on Monday February 17, 2020 @05:50PM (#22351678)
Not OP, but here are the lines my i3 config:

    bindsym XF86MonBrightnessDown exec "xbacklight -dec 10"
    bindsym XF86MonBrightnessUp exec "xbacklight -inc 10"
Re:i3 4.18 by ravar on Monday February 17, 2020 @05:39PM (#22351591)
one hacky way to configure it is too install xfce4-power-manager and then run it in your config file. then the power manager will also handle the brightness keys.
Re:i3 4.18 by Naac on Monday February 17, 2020 @07:03PM (#22352178)
What about sleep, display management when pluging in another monitor? etc.
Re:i3 4.18 by riccardomc on Tuesday February 18, 2020 @02:38PM (#22359529)
I have a set of scripts that extend my screen to the right at max resolutions and reflows the workspaces in numeric order. It is generic enough to work with any number of displays.

You might need X11 python bindings and other dependencies that in general should be available on most distros.

See if it works for you, enjoy:

https://github.com/riccardomc/rcs/blob/master/scripts/.scrip...

Re:i3 4.18 by leeman2016 on Tuesday February 18, 2020 @03:31AM (#22354407)
If you are looking for usage from just i3, I am using xrandr to enable/disable multi-monitor:

    $mod+Shift+p exec "xrandr --output HDMI1 --auto --right-of eDP1"
(that with enable second screen through HDMI when Win+Shift+p is pressed)

    $mod+Shift+o exec "xrandr --output HDMI1 --off"
(that disables second screen)

    bindsym $mod+Shift+x move workspace to output HDMI1
(that moves an entire workspace to the 2nd screen or any screen with the given id)
Re:i3 4.18 by downtide on Tuesday February 18, 2020 @04:13AM (#22354576)
Shunting workspaces about is a great idea.
Re:i3 4.18 by bombela on Monday February 17, 2020 @03:45PM (#22350568)
I have been using the mate desktop daemons to handle all of this. Works quite well. See my comment with more details there: https://news.ycombinator.com/item?id=22302834
Re:i3 4.18 by Symmetry on Monday February 17, 2020 @03:42PM (#22350539)
I tried that for a while and I did find the integration very well done. I ended up going back to my automatic-tiling Gnome/Xmonad ways (thanks Gekkio!) but that was all about window manager preferences themselves rather than any fault in the Regolith project.
Re:i3 4.18 by mttyng on Monday February 17, 2020 @04:05PM (#22350749)
This looks cool. I didn’t immediately see anything mentioned, but can I set this up as an alternative WM and select it in my gnome-login-manager screen? Or do I have to install it as a completely separate DM?

Also, is this really only for Ubuntu?

Re:i3 4.18 by Naac on Monday February 17, 2020 @04:30PM (#22350990)
>> can I set this up as an alternative WM and select it in my gnome-login-manager screen?

Yes.

>> Or do I have to install it as a completely separate DM?

I'm not sure what you mean. The Ubuntu package provided lets you select this desktop from the login screen ( as opposed to i3, Plasma, or Gnome ). This is essentially a new Desktop Environment, made up of gnome and i3.

>> Also, is this really only for Ubuntu?

Unfortunately yes. I've tried looking at packaging this for Arch Linux, but it looks like quite a bit of dependencies are forked ( i3blocks is now i3xrocks ). Not everything is pushed upstream. Getting this to work on non-ubuntu based distributions looks tricky if you're not familiar with packaging already.

Re:i3 4.18 by cyberbanjo on Tuesday February 18, 2020 @03:10AM (#22354317)
This sounds great. I've used an i3 dmenu setup and is was nice. Re configuring however sounds unpleasant.
Re:i3 4.18 by ckrailo on Wednesday February 19, 2020 @01:09AM (#22363428)
+1 for regolith and the quality Slack community around it! Ken is awesome!
Re:i3 4.18 by thunderbong on Monday February 17, 2020 @03:50PM (#22350612)
This is really nice. The key bindings out of the box are really useful.