2011. június 12., vasárnap

Repository hozzáadása (add-apt-repository Debianban)

Találtam egy jó kis Bash scriptet, amivel hozzáadhatunk ubuntumentes környezetben is repositorykat a szoftvertárolókhoz.
Ehhez a következőket kell tennünk:

cd /usr/sbin/
sudo gedit add-apt-repository
A megnyíló geditbe illesszük be a következő scriptet:

#!/bin/bash
if [ $# -eq 1 ]
then
ppa_name=`echo "$1" | cut -d":" -f2 -s`
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/apt_add_key.txt
key=`cat /tmp/apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3`
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
Mentsük el a fájlt, majd tegyük futtathatóvá és állítsuk be a jogosultságokat:

sudo chmod o+x /usr/sbin/add-apt-repository
sudo chown root:root /usr/sbin/add-apt-repository

2011. június 9., csütörtök

Crunchbang szépítés

Az új Ubuntu (Natty Narwhal) megjelenésével együtt váltottam Crunchbangre. Ennek több oka is volt, nem nagyon jön be az új ubuntus irány, remélem még visszatérnek arra a vonalra, amit régen követtek. Korábban is kipróbáltam már a Crunchbang-et és akkor is tetszett már, most viszont főállású oprendszerként használom.
Ez a rendszer inkább a hozzáértőbb linuxosoknak lett kitalálva, ez már a kinézetéből is látszik. Természetesen a kinézet kis elszántsággal elég szépre varázsolható, és ehhez nem is kell engednünk a rendszer gyorsaságából annyit.
Most így néz ki az asztalom:
Először az alsó panelt tettem félig átlátszóvá, ehhez a Tint panel config fájlját (jobb klikk->Settings->tint2 Panel Config->Edit config file) kell szerkeszteni.
Az enyém most ez:
#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------
# For more information about tint2, see:
# http://code.google.com/p/tint2/wiki/Welcome
#
# For more config file examples, see:
# http://crunchbanglinux.org/forums/topic/3232/my-tint2-config/

# Background definitions
# ID 1
rounded = 5
border_width = 0
background_color = #000000 50
border_color = #FFFFFF 20

# ID 2
rounded = 5
border_width = 0
background_color = #000000 100
border_color = #ffffff 20

# ID 3
rounded = 5
border_width = 0
background_color = #000000 40
border_color = #000000 1

# ID 4
rounded = 5
border_width = 1
background_color = #888888 20
border_color = #ED2323 60

# ID 5 - taskbar
rounded = 0
border_width = 0
background_color = #000000 0
border_color = #000000 0

# ID 6 - active taskbar
rounded = 0
border_width = 1
background_color = #d8d8d8 8
border_color = #d8d8d8 0

# ID 7 - tooltip
rounded = 3
border_width = 0
background_color = #222222 90
border_color = #222222 90

# ID 8
rounded = 1
border_width = 1
background_color = #888888 20
border_color = #888888 20

# Panel
panel_monitor = all
panel_position = bottom center horizontal
panel_items = TSC
panel_size = 98% 30
panel_margin = 0 0
panel_padding = 0 0
panel_dock = 0
wm_menu = 1
panel_layer = bottom
panel_background_id = 1

# Panel Autohide
autohide = 0
autohide_show_timeout = 0.3
autohide_hide_timeout = 1.5
autohide_height = 6
strut_policy = follow_size

# Taskbar
taskbar_mode = multi_desktop
taskbar_padding = 6 0 6
taskbar_background_id = 5
taskbar_active_background_id = 3
taskbar_name = 1
taskbar_name_background_id = 0
taskbar_name_active_background_id = 0
taskbar_name_font = sans 9
taskbar_name_font_color = #d8d8d8 100
taskbar_name_active_font_color = #d8d8d8 100

# Tasks
urgent_nb_of_blink = 20
task_icon = 1
task_text = 0
task_centered = 1
task_maximum_size = 40 40
task_padding = 2 2
task_background_id = 5
task_active_background_id = 2
task_urgent_background_id = 4
task_iconified_background_id = 3

# Task Icons
task_icon_asb = 50 0 0
task_active_icon_asb = 100 0 0
task_urgent_icon_asb = 100 0 0
task_iconified_icon_asb = 60 0 0

# Fonts
task_font = sans 06_55 6
task_font_color = #d8d8d8 60
task_active_font_color = #d8d8d8 100
task_urgent_font_color = #FFFFFF 100
task_iconified_font_color = #d8d8d8 60
font_shadow = 0

# Launcher
launcher_padding = 8 4 4
launcher_background_id = 0
launcher_icon_size = 24
# Specify icon theme names with launcher_icon_theme.
# if you have an XSETTINGS manager running (like xfsettingsd), tint2 will follow your current theme.
launcher_icon_theme = gnome-colors-statler
# Each launcher_item_app must be a full path to a .desktop file
launcher_item_app = /usr/share/applications/terminator.desktop
launcher_item_app = /usr/share/applications/xfce4-file-manager.desktop
launcher_item_app = /usr/share/applications/gedit.desktop
launcher_item_app = /usr/share/applications/iceweasel.desktop

# System Tray
systray = 1
systray_padding = 4 2 3
systray_sort = ascending
systray_background_id = 0
systray_icon_size = 24
systray_icon_asb = 100 0 0

# Clock
time1_format = %H:%M:%S
time1_font = sans 8
time2_format = %A %d %B
time2_font = sans 6
clock_font_color = #d8d8d8 100
clock_padding = 4 4
clock_background_id = 0
clock_lclick_command = gsimplecal
clock_rclick_command = gsimplecal

# Tooltips
tooltip = 1
tooltip_padding = 2 2
tooltip_show_timeout = 0.0
tooltip_hide_timeout = 0.0
tooltip_background_id = 7
tooltip_font_color = #d8d8d8 100
tooltip_font = sans normal 8.0

# Mouse
mouse_middle = none
mouse_right = toggle
mouse_scroll_up = toggle
mouse_scroll_down = iconify

# Battery
battery = 1
battery_low_status = 20
battery_low_cmd = notify-send "battery low"
battery_hide = 96
bat1_font = Sans 10
bat2_font = Sans 8
battery_font_color = #FFFFFF 100
battery_padding = 2 0
battery_background_id = 0

# End of config
Közben váltottam régi kedvenc zenelejátszómról az Audacious-ról is, a DeadBeef nevűre. Egyszer már írtam erről a lejátszóról is egy tesztben. Ahhoz, hogy a Conky-ban a zenék jól jelenjenek meg, a Conky config fájlját is kicsit szerkeszteni kell. Ehhez vegyük az előző cikkben megírt config fájlt, és a Music részt írjuk át erre:
MUSIC ${hr 2}
${alignc 20}${font Buttons and Switches JL:size=38}J${font}
$alignc ${exec deadbeef --nowplaying "%a - %t"} (${exec deadbeef --nowplaying "%l"})
${execbar python /home//.scripts/deadbeef.py}$endif
A hallgatott zene progressbar-jának működéséhez írtam egy kisebb python scriptet, amit a home könyvtárunkban a ".script" mappában kell elhelyezni "deadbeef.py" néven. Tartalma a következő:
#!/usr/bin/env python

import os

bashcmd=os.popen("deadbeef --nowplaying %l")
length=bashcmd.read()
bashcmd=os.popen("deadbeef --nowplaying %e")
elapsed=bashcmd.read()

sec=length[-2:]
min=length[:-3]
t1=int(min)*60+int(sec)

sec=elapsed[-2:]
min=elapsed[:-3]
t2=int(min)*60+int(sec)
print float(t2)/float(t1)*100
(Ez a szkript amúgy egy számot állít elő, ami az éppen hallgatott zeneszámban mondja meg százalékban, hogy hol tartunk a zenehallgatásban a zeneszám teljes hosszához képest.)

A hátteret pedig erről az oldalról szereztem be. Sok sikert a csinosításhoz! :)