i3m – Reffffference https://ivan.reallusiondesign.com For my personal reference purposes Tue, 27 Aug 2019 14:50:11 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 106465655 i3wm brightness control on T480s https://ivan.reallusiondesign.com/i3wm-brightness-control-on-t480s/ https://ivan.reallusiondesign.com/i3wm-brightness-control-on-t480s/#disqus_thread Mon, 19 Aug 2019 16:54:52 +0000 https://ivan.reallusiondesign.com/?p=967 I got a new laptop – Thinkpad t480s – it is a great machine!
But since I like to use i3wm for my work, there was a bit of a problem with the way I control the brightness on my old machine. I had two scripts which were triggering when I press the function keys which were detected as XF86MonBrightnessDown and XF86MonBrightnessUp

The problem is that this newer machine was not detecting these keys with xev and when I was using the function keys for the screen brightness acpi events were triggered, so I needed to find how to catch the key presses.

So bellow is what I used in order to control my brightness.
First of all you need to find out what keys acpi detects, you can do that with acpi_list.
In my case the output of it was the keys video/brightnessup BRTUP 00000086 00000000
and video/brightnessdown BRTDN 00000087 00000000

So the next step is to add new acpi event. This is very straightforward, for ubuntu you just go to the /etc/acpi/events/ folder and create two files there – one for increasing the brightness and one for decreasing it. What you put in these files is simply what command or script to be executed when that key is pressed. I will give example with just the brightness increase scripts, as the brightness decrease are basically the same, just the key and script is different, so you should not have any problems adding the others.

So my /etc/acpi/events/brightness_up looks like this

# /etc/acpi/events/brightness_up
# This is called when the user presses the brightness up button and calls
# /home/ivan/.config/i3/brightness_up.sh which will increase the screen brightness.
# Author: Ivan Denkov

event=video/brightnessup BRTUP 00000086 00000000
action=/etc/acpi/brightness_up.sh

This trigger the script located in /etc/acpi/brightness_up.sh you need to make that script executable, and this are the contents to go there. Here is the script:

#!/bin/bash
CAT="$(which cat)"
current_brightness=`$CAT /sys/class/backlight/intel_backlight/brightness`
new_brightness=$(($current_brightness+20))
echo $new_brightness > /sys/class/backlight/intel_backlight/brightness

You just need to replicate the event and the script for lowering the brightness and you should be good to go.
If for some reason the above does not work, make sure that:
– You have made the bash scripts executable.
– Make sure the bash scripts by itself can change the brightness(It is actually working)
– Double check acpi_listen to make sure you have put the correct keys in the events.

I assume it will be practically the same procedure on the Thinkpad T480.

]]>
https://ivan.reallusiondesign.com/i3wm-brightness-control-on-t480s/feed/ 0 967
Remap print key to Super(windows) in i3wm https://ivan.reallusiondesign.com/remap-print-key-to-superwindows-in-i3wm/ https://ivan.reallusiondesign.com/remap-print-key-to-superwindows-in-i3wm/#disqus_thread Tue, 16 Oct 2018 22:52:03 +0000 https://ivan.reallusiondesign.com/?p=884 My laptop keyboard is little annoying – it have a Print Screen(PrtSc) button between my right control and alt keys – usually around that area you will find the windows(super) key, so I wanted to remap it, when i am using i3wm.

So first of all you need to make sure what is your key “called”, you can to that with the xev program.

Then you need to get your modifier map with: xmodmap -pm
In my case my output was this:

xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

I use mod4 for my i3 config, so I needed to add the Print key to the mod4 modifier with this command:

xmodmap -e "add mod4 = Print"

After that we see that Print is added to the mod4:

mod4        Print (0x6b),  Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf),  Print (0xda)

And you will probably want to add this command to your i3 config so it get excuted on each boot:

exec --no-startup-id /usr/bin/xmodmap -e "add mod4 = Print"
]]>
https://ivan.reallusiondesign.com/remap-print-key-to-superwindows-in-i3wm/feed/ 0 884