OpenBox

From The World according to Vissie
Jump to navigation Jump to search

My OpenBox notes

apt-get install xorg openbox dbus-x11 terminator feh imagemagick
apt-get install ranger atool
visudo

Four key files form the basis of the openbox configuration, each serving a unique role. They are: rc.xml, menu.xml, autostart, and environment. To start configuring Openbox, it will first be necessary to create a local Openbox profile (i.e for your specific user account) based on them. This can be done by copying them from the global /etc/xdg/openbox profile (applicable to any and all users) as a template:

cp -R /etc/xdg/openbox ~/.config

Display Manager / locker

apt-get install lightdm light-locker
vim: /etc/lightdm/lightdm-gtk-greeter.config
...
[greeter]
background=/usr/share/backgrounds/someime.svg
theme-name=DeLorean-Dark-3.16-Alt
...

I had to imagemagick convert my background image from jpg to svg

If you have a dual screen and your greeter did not pick that up, you can force it with a script. Here is my script:

vim: /usr/bin/dualmon.sh
#!/bin/bash
xrandr --addmode DVI-1 1440x900
xrandr --auto --output DVI-1 --mode 1440x900  --left-of DVI-0 --primary
xrandr --auto --output DVI-0 --mode 1680x1050 --right-of DVI-1

And then you call that from your greeter config file. In Debian the section is missing. Do add that! [SeatDefaults]. in Arch these settings is in: /etc/lightdm/lightdm.conf and under [Seat:*]

vim: /etc/lightdm/lightdm-gtk-greeter.config
...
[SeatDefaults]
display-setup-script = /usr/bin/dualmon.sh
session-setup-script = /usr/bin/dualmon.sh
...

Changing your avatar

If you want to change your avatar, do the following.

sudo apt-get install accountsservice

My

vim: /etc/lightdm/lightdm.conf
...
greeter-hide-users=false
...
vim: /usr/share/lightdm/lightdm.conf.d/01_debian.conf
...
greeter-hide-users=false
...
vim: /var/lib/AccountsService/users/username
[User]
Icon=/var/lib/AccountsService/icons/username

Then copy the file to /var/lib/AccountsService/icons/username.png

If you wanted light-locker to wait a minute before locking the screen after it has blanked out, your configuration would have to look like this:

vim: /etc/xdg/autostart/light-locker.desktop
...
Exec=light-locker --lock-after-screensaver 60
...

Are you sure light-locker is running? Is it enabled? Test with:

light-locker-command &
light-locker-command --lock
light-locker-command -l

Have you already checked the output of "strace light-locker-command --lock"?

For a nice background

apt-get install feh
feh --bg-fill /my/file.jpg

Then add one of these lines to your autorun config file

# restore last image
sh ~/.fehbg &
# cycle through a directory of images
feh --bg-scale "$(find ~/Images/Backgrounds -type f |sort -R |tail -1)" "$(find ~/Images/Backgrounds/ -type f |sort -R |tail -1)"
vim: ~.config/openbox/autostart
...
sh ~/.fehbg &
...

File run command

apt-get install gmrun 
vim: /etc/gmrunrc
...
TabTimeout = 900
...

on Arch Linux:

vim: /usr/share/gmrun/gmrunrc
...
# Set window geometry (except height)
Width = 400
Top = 400
Left = 60
...


Screen capture

sudo apt-get install xfce4-screenshooter xfce4-clipman

Not sure if I should add this to my auto start file?

xfce4-screenshooter --fullscreen --clipboard
xfce4-screenshooter --region --clipboard

Image Viewer

GPicView
Geeqie

Keyboard shortcuts

vim: ~/.config/openbox/rc.xml
<keybind key="W-c">     <action name="Execute"><command>terminator</command></action></keybind>
<keybind key="W-r">     <action name="Execute"><command>gmrun</command></action></keybind>


<keybind key="C-S-z"><action name="Execute"><command>xfce4-screenshooter</command></action></keybind>              

<keybind key="C-A-l">   <action name="Execute"><command>xscreensaver-command -lock</command></action></keybind>
<keybind key="W-l">     <action name="Execute"><command>sh -c "sleep 0.25; xset dpms force off"</command></action></keybind>

### This worked for me in Arch ###
<keybind key="W-l">     <action name="Execute"><command>dm-tool lock</command></action></keybind>

<keybind key="W-Prior">  <action name="Execute"><execute>amixer sset Master 1000+</execute></action></keybind>
<keybind key="W-Next">   <action name="Execute"><execute>amixer sset Master 1000-</execute></action></keybind>
<keybind key="W-Delete"> <action name="Execute"><execute>amixer sset Master toggle</execute></action></keybind>

<keybind key="W-Prior">  <action name="Execute"><execute>pactl set-sink-volume 0 -- +1%</execute></action></keybind>
<keybind key="W-Next">   <action name="Execute"><execute>pactl set-sink-volume 0 -- -1%</execute></action></keybind>

<placement>
  <policy>Smart</policy>
  <!-- 'Smart' or 'UnderMouse' -->
  <center>yes</center>
  <!-- whether to place windows in the center of the free area found or
     the top left corner -->
  <monitor>Primary</monitor>
  <!-- with Smart placement on a multi-monitor system, try to place new windows
     on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where
     the active window is, 'Primary' - only on the primary monitor -->
  <primaryMonitor>1</primaryMonitor>
  <!-- The monitor where Openbox should place popup dialogs such as the
     focus cycling popup, or the desktop switch popup.  It can be an index
     from 1, specifying a particular monitor.  Or it can be one of the
     following: 'Mouse' - where the mouse is, or
                'Active' - where the active window is -->
</placement>
openbox --reconfigure

Intuitively, to have dialogs showed on the monitor on the right you have to replace 1 with 2 in the <primaryMonitor> tag. Choose Mouse if you want dialogs following your mouse or (my ultimate choice) Active, that shows dialogs on the monitor where the active window is. Brilliant

To see what a key is called, ru

xev

KeyRelease event, serial 48, synthetic NO, window 0x5400001,
   root 0x2c5, subw 0x0, time 1748286402, (-645,70), root:(2061,911),
   state 0x10, keycode 117 (keysym 0xff56, Next), same_screen YES,
   XLookupString gives 0 bytes: 
   XFilterEvent returns: False

Here I hit the Page-Down key, see the word "Next"?

Dual screen

First, type xrandr in a terminal. This will display the detected monitors and their resolution.

Now, you can enter a command to adjust the resolution and layout of your displays:

xrandr --auto --output VGA-1 --mode 1440x900 --right-of LVDS-1

That command is for the external monitor I usually have to the right of my laptop. VGA-1 is the external monitor and LVDS-1 is my laptop's built in monitor. This command tells xrandr to arrange the external monitor to the right and set the resolution to 1440x900.

I then use this command:

xrandr --auto --output LVDS-1 --mode 1280x800 --left-of VGA-1 

to set the resolution of my internal display. I usually add these two commands to openbox's autostart script (/etc/xdg/openbox/autostart) so that Xrandr sets my displays properly when openbox starts up.

Screen brightness

sudo su -c 'echo 10 > /sys/class/backlight/acpi_video0/brightness'
xrandr --output LVDS-1 --brightness 0.9

Look at his apps:

http://yuri-rage.github.io/geekery/2014/06/05/rolling-with-arch/
http://melp.nl/2011/01/10-must-have-key-and-mouse-binding-configs-in-openbox/

When you start Openbox, you will notice that your Gtk applications use the default (‘ugly’) grey theme and icons and the default font. There are several ways in which you can change the Gtk themes in Openbox:

gtk2 Theme change

LXappearance, Gtk-theme-switch and Gtk-chtheme are three small applications that enable you to change the Gtk themes and fonts. Of these three, LXappearance has the most options

apt-get install lxappearance

panel

Look at tint2

apt-get install tint2

Network Manager applet. A must

sudo apt-get install network-manager
sudo apt-get install network-manager-gnome

Enabling Interface Management


http://www.intellamech.com/RaspberryPi-projects/rpi_nmcli.html

If you want NetworkManager to handle interfaces that are enabled in /etc/network/interfaces:

Set managed=true in /etc/NetworkManager/NetworkManager.conf.

/etc/init.d/network-manager restart

Normally, a right-click desktop menu will automatically be generated for you on installation. If, however, your desktop menu is not being auto-generated with DebianMenu, you will have to install the menu package:

apt-get install menu

auto login

vim: /etc/lightdm/lightdm.conf
...
[Seat:*]
...
autologin-user=username
autologin-user-timeout=0
pam-service=lightdm-autologin
...

Autorun

My autorun has grown. Lets keep tack of it

vim: ~/.config/openbox/autorun

xrandr --addmode DVI-1 1440x900
xrandr --auto --output DVI-1 --mode 1440x900  --left-of DVI-0 --primary
xrandr --auto --output DVI-0 --mode 1680x1050 --right-of DVI-1
# sh ~/.fehbg &
feh --bg-scale "$(find ~/Pictures/background/ -type f |sort -R |tail -1)" "$(find ~/Pictures/background/ -type f |sort -R |tail -1)" &
tint2 &
xscreensaver-command -exit &
xscreensaver -no-splash &
xset +dpms &
xset dpms 600 1200 1800 &
conky &

obmenu-generator

Install dependencies:

 sudo apt-get install build-essential cpanminus git

Install the generator:

git clone git://github.com/trizen/obmenu-generator
sudo cp obmenu-generator/obmenu-generator /usr/bin
mkdir ~/.config/obmenu-generator/
sudo cp -r obmenu-generator/schema.pl ~/.config/obmenu-generator/
sudo cpanm Linux::DesktopFiles
sudo cpanm Data::Dump
sudo chmod +x /usr/bin/obmenu-generator

Run the generator.

obmenu-generator -p -i

Sound mixer

sudo apt-get install pnmixer

Power management

sudo apt-get install xfce4-power-manager

If you having issues, maybe try xautolock:

xautolock -time 10 -locker fuzzy_lock -notify 20 -notifier 'xset dpms force off' &
xautolock -time 15 -locker "systemctl suspend" &

File Managers

If you have to do a file manager, look at

pcmanfm is a fast and lightweight file manager with network and trash support, it also ends up having some bonus functionality that will be very useful. 

In order to have pcmanfm manage the desktop, it should be started in desktop mode in the “autostart” file.

pcmanfm --desktop &
thunar

Trash and Drive Management

In order to use many of the functions that are in file managers it is necessary to have a a few additional programs. gvfs gives you the ability to mount volumes and have trash control. It is not mandatory to have, but it allows on demand mounting to be done completely within the file manager, as opposed to having to drop down to the command line.

udevil for USB drive management.

Compositor

A compositor is an optional component of an open box setup, it can give a few niceties that such as transparency, and fading by buffering the input off screen before displaying it. Openbox does not have a built-in compositor but there are a few good options that work nicely with it. The one I’ve been using, and have been quite happy with is Compton.

Run Compton in the background with shadows.

compton -b -c &
compton --config "~/.config/compton.conf"

xfdeskop

Sometimes I have issues that my right click menu does not have icons. Try this:

pacaur -S xfce4-settings

volume

pacaur -S volumeicon
volumeicon & (set left click actions)

Date time

%a %d %b <b>%R</b>
<span color="#33FF33">%a %m-%B %d%n%I:%M %p</span>
%a %d %b <span color="#00FF00"><b>%R</b></span>

Monitoring

bpytop

http://packages.azlux.fr/

Workspaces

Is there a way to set the number of rows for desktop workspaces without using the xfce-panel applet "Workspace Switcher"?

xprop -root -f _NET_NUMBER_OF_DESKTOPS 32c -set _NET_NUMBER_OF_DESKTOPS 6