One of the best features on openbox comes "hidden" in Fluxbox. To use it, put a line in your "keys" (/home/"user"/.fluxbox/keys) file like that:
Mod4 Escape :ClientMenu
In my case, when I click windows button+escape I get:
That's it!
Na Pata Da Esfinge...
Impressões argutas sobre o mundo.
sábado, 24 de novembro de 2018
Creating a Custom Shutdown Menu in Fluxbox
This is easy.
Just edit fluxbox "keys" inserting a line like that:
Mod4 x :CustomMenu "path-to-menu"
Of course the menu you're pointing at must exist in ~/.fluxbox.
In my case, I've done that:
$ touch /home/pibarnas/.fluxbox/sair
$ echo "[begin] (Sair) \n \t [exit] (Sair) {Exit} \n \t [exec] (Desligar) {/sbin/shutdown -h now} \n \t [exec] (Reiniciar) {/sbin/shutdown -r now} \n [end]" > /home/pibarnas/.fluxbox/sair
$ cat /home/pibarnas/.fluxbox/sair
[begin] (Sair)
[exit] (Sair) {Exit}
[exec] (Desligar) {/sbin/shutdown -h now}
[exec] (Reiniciar) {/sbin/shutdown -r now}
[end]
My ~/.fluxbox/keys related line:
Mod4 x :CustomMenu /home/pibarnas/.fluxbox/sair
Now when I click windows button+x this menu appear:
You can make custom menus other than the default one as you wish. Hope you like the tip!
Just edit fluxbox "keys" inserting a line like that:
Mod4 x :CustomMenu "path-to-menu"
Of course the menu you're pointing at must exist in ~/.fluxbox.
In my case, I've done that:
$ touch /home/pibarnas/.fluxbox/sair
$ echo "[begin] (Sair) \n \t [exit] (Sair) {Exit} \n \t [exec] (Desligar) {/sbin/shutdown -h now} \n \t [exec] (Reiniciar) {/sbin/shutdown -r now} \n [end]" > /home/pibarnas/.fluxbox/sair
$ cat /home/pibarnas/.fluxbox/sair
[begin] (Sair)
[exit] (Sair) {Exit}
[exec] (Desligar) {/sbin/shutdown -h now}
[exec] (Reiniciar) {/sbin/shutdown -r now}
[end]
My ~/.fluxbox/keys related line:
Mod4 x :CustomMenu /home/pibarnas/.fluxbox/sair
Now when I click windows button+x this menu appear:
You can make custom menus other than the default one as you wish. Hope you like the tip!
terça-feira, 5 de maio de 2015
Append suffix in linux file names with Shell Parameter Expansion
Well, everytime I read about shell (bash) parameter expansion I see examples ripping off the suffixes. But someday, I needed to do the inverse: Append suffixes. How to do that?
I've made a simple bash script to do so:
#!/bin/bash
for i in *; do
mv ${i} ${i}.sh;
done
exit 0
I've made a simple bash script to do so:
#!/bin/bash
for i in *; do
mv ${i} ${i}.sh;
done
exit 0
Using a for loop, I moved every file in the directory to the same name, with a ".sh" appended as suffix.
Feel free to change the suffix you want.
To revert:
#!/bin/bash
for i in *; do
mv ${i} ${i/.sh/};
done
exit 0
In this case, in every file of the directory, ".sh" will be substituted for nothing. It may cause some troubles. Let's suppose you have a dir, full of these files:
1.shellvpower
2.shellvpower
3.shellvpower
4.shellvpower
They'll become:
1ellvpower
2ellvpower
3ellvpower
4ellvpower
So, in a better way, to remove only the suffixes ".sh":
for i in *; do
mv ${i} ${i%%\.sh};
done
exit 0
Bonus:
Append prefixes:
To append, for instance, prefix "waka":
#!/bin/bash
for i in *; do
mv ${i} ${i/#/waka};
done
Tip: "#" is before "i" (so, prefix). "%" would be after "i".
It also can be done in a simpler way:
#!/bin/bash
for i in *; do
mv ${i} waka${i};
done
That's all, folks!!
To revert:
#!/bin/bash
for i in *; do
mv ${i} ${i/.sh/};
done
exit 0
In this case, in every file of the directory, ".sh" will be substituted for nothing. It may cause some troubles. Let's suppose you have a dir, full of these files:
1.shellvpower
2.shellvpower
3.shellvpower
4.shellvpower
They'll become:
1ellvpower
2ellvpower
3ellvpower
4ellvpower
So, in a better way, to remove only the suffixes ".sh":
for i in *; do
mv ${i} ${i%%\.sh};
done
exit 0
Bonus:
Append prefixes:
To append, for instance, prefix "waka":
#!/bin/bash
for i in *; do
mv ${i} ${i/#/waka};
done
Tip: "#" is before "i" (so, prefix). "%" would be after "i".
It also can be done in a simpler way:
#!/bin/bash
for i in *; do
mv ${i} waka${i};
done
That's all, folks!!
terça-feira, 17 de março de 2015
Ultimate Guide for good Looking Fonts on Opensuse (13.2) - without Infinality
Well, as I'm using opensuse 13.2 as OS in one of my disks, let's see how we can improve the look of its horrible fonts.
First: Yast2>/etc/sysconfig editor>Desktop, as seen below:
Play with font configs in each field. Mine I set as below:
FORCE_HINTSTYLE: hintfull
FORCE_AUTOHINT: yes
FORCE_BW: no
FORCE_BW_MONOSPACE: no
USE_LCDFILTER: lcddefault
USE_RGBA: rgb
These settings will make the links on /etc/fonts/conf.d, disabled by default on opensuse. Other way to make this, as root:
cd /etc/fonts/conf.d/
ln -s /usr/share/fontconfig/conf.avail/10-autohint.conf
ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf
ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf
Make a file named user.js in $HOME/.mozilla/firefox/*.default/ with this content:
user_pref("font.FreeType2.enable", "true");
user_pref("font.FreeType2.autohinted", "true");
user_pref("font.FreeType2.printing", "true");
user_pref("font.FreeType2.unhinted", "false");
To improve fonts and other enhancements on firefox, I use the excellent ArchWiki, mainly for dpi adjustments (I'm not a fanboy of just one distro but since I'm linux user since 1997, I understand distros are just some kind of free expression to get the same thing, like religions, and btw I used arch, made good friends and learn a lot from some years because of the experience, but the rolling release model doesn't fit on the plans of my server). Here's the link: Firefox tweaks on ArchWiki
Add some related lines to Xdefaults, if it doesn't have:
echo -e "Xft.autohint: 1\nXft.lcdfilter: lcddefault\nXft.hintstyle: hintfull\nXft.hinting: 1\nXft.antialias: 1\nXft.dpi: 144\nXft.rgba: rgb" >> ~/.Xdefaults
As I use a 1920x1080 monitor resolution, I use dpi=144, so pay attention to this set on .Xdefaults above and set accordingly to your own set.
And because of that, I made a xrandr.desktop to set dpi through xrandr as well, to autostart in LXDE:
[Desktop Entry]
Name=Xrandr
Terminal=true
Type=Application
Exec=xrandr --dpi 144
In lxappearance (LXDE), I set like this:
Result:
That's all. I hope this simple tuto helps the other Opensuse users with the bad looking fonts on this great distro (IMHO).
First: Yast2>/etc/sysconfig editor>Desktop, as seen below:
Play with font configs in each field. Mine I set as below:
FORCE_HINTSTYLE: hintfull
FORCE_AUTOHINT: yes
FORCE_BW: no
FORCE_BW_MONOSPACE: no
USE_LCDFILTER: lcddefault
USE_RGBA: rgb
These settings will make the links on /etc/fonts/conf.d, disabled by default on opensuse. Other way to make this, as root:
cd /etc/fonts/conf.d/
ln -s /usr/share/fontconfig/conf.avail/10-autohint.conf
ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf
ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf
Make a file named user.js in $HOME/.mozilla/firefox/*.default/ with this content:
user_pref("font.FreeType2.enable", "true");
user_pref("font.FreeType2.autohinted", "true");
user_pref("font.FreeType2.printing", "true");
user_pref("font.FreeType2.unhinted", "false");
To improve fonts and other enhancements on firefox, I use the excellent ArchWiki, mainly for dpi adjustments (I'm not a fanboy of just one distro but since I'm linux user since 1997, I understand distros are just some kind of free expression to get the same thing, like religions, and btw I used arch, made good friends and learn a lot from some years because of the experience, but the rolling release model doesn't fit on the plans of my server). Here's the link: Firefox tweaks on ArchWiki
Add some related lines to Xdefaults, if it doesn't have:
echo -e "Xft.autohint: 1\nXft.lcdfilter: lcddefault\nXft.hintstyle: hintfull\nXft.hinting: 1\nXft.antialias: 1\nXft.dpi: 144\nXft.rgba: rgb" >> ~/.Xdefaults
As I use a 1920x1080 monitor resolution, I use dpi=144, so pay attention to this set on .Xdefaults above and set accordingly to your own set.
And because of that, I made a xrandr.desktop to set dpi through xrandr as well, to autostart in LXDE:
[Desktop Entry]
Name=Xrandr
Terminal=true
Type=Application
Exec=xrandr --dpi 144
In lxappearance (LXDE), I set like this:
Result:
That's all. I hope this simple tuto helps the other Opensuse users with the bad looking fonts on this great distro (IMHO).
sexta-feira, 7 de março de 2014
Autostarting apps with LXDE
In a term:
#touch .config/lxsession/LXDE/autostart
#cat .config/lxsession/LXDE/autostart
@pcmanfm
Now, LXDE will load pcmanfm on its start. Simply put what you want on the lines (apps), just remembering to put "@" before entry.
That's it!
#touch .config/lxsession/LXDE/autostart
#cat .config/lxsession/LXDE/autostart
@pcmanfm
Now, LXDE will load pcmanfm on its start. Simply put what you want on the lines (apps), just remembering to put "@" before entry.
That's it!
Adding sound to LXDE start
Simple.
Make a .desktop file and put it in ~/.config/autostart (if this dir doesn't exist, then create it):
# mkdir ~/.config/autostart
#touch ~/.config/autostart/sound.desktop
As you see, my file's named sound.desktop
Which contents may be:
[Desktop Entry]
Name=Sound
Terminal=true
Type=Application
Exec=mplayer /home/pibarnas/Downloads/221359__melliug__newmessage.mp3
I've downloaded mine from freesound.org. There's a lot of sounds there. Enjoy!
Make a .desktop file and put it in ~/.config/autostart (if this dir doesn't exist, then create it):
# mkdir ~/.config/autostart
#touch ~/.config/autostart/sound.desktop
As you see, my file's named sound.desktop
Which contents may be:
[Desktop Entry]
Name=Sound
Terminal=true
Type=Application
Exec=mplayer /home/pibarnas/Downloads/221359__melliug__newmessage.mp3
I've downloaded mine from freesound.org. There's a lot of sounds there. Enjoy!
segunda-feira, 29 de abril de 2013
Shutting down or restarting using openbox (with chroot)
First, your user must be allowed to shut down the system. Do it editing /etc/sudoers (a glance at man should help). We don't focus the edition of sudoers here. Then, add to you rc.xml (making backup of it first, always):
<keybind key="C-A-Delete" chroot="true">
<keybind key="r">
<action name="Execute">
<prompt>Reiniciar o sistema?</prompt>
<execute>reboot</execute>
</action>
</keybind>
<keybind key="x">
<action name="Execute">
<prompt>Desligar o sistema?</prompt>
<execute>poweroff</execute>
</action>
</keybind>
<keybind key="Escape">
<action name="BreakChroot"/>
</keybind>
Doing so, when pressing ctrl+alt+del you'll be sent into a chroot that allows you to press x or r, the first will prompt a message to shutdown the system and the other, to restart it. If "yes" is chosen, the magic's done. Hope you like the tip.
Assinar:
Postagens (Atom)