使い方 †設定 †Widget †textclock †
情報:どくたーぺっぱーちぇりお 春なのに、awesomeでおー寒っ! delightful †% sudo pacman -S gnome-icon-theme % yaourt -S sensors-applet % sudo pacman -S lua-socket lua-sec % sudo pacman -S libgweather
batteryinfo †battery.lua -- This function returns a formatted string with the current battery status. It -- can be used to populate a text widget in the awesome window manager. Based -- on the "Gigamo Battery Widget" found in the wiki at awesome.naquadah.org local naughty = require("naughty") local beautiful = require("beautiful") function batteryInfo(adapter) local percent local icon local battery local fh = io.open("/sys/class/power_supply/"..adapter.."/present", "r") if fh == nil then battery = "A/C" icon = "" percent = "" else local fcur = io.open("/sys/class/power_supply/"..adapter.."/energy_now") local fcap = io.open("/sys/class/power_supply/"..adapter.."/energy_full") local fsta = io.open("/sys/class/power_supply/"..adapter.."/status") local cur = fcur:read() local cap = fcap:read() local sta = fsta:read() fcur:close() fcap:close() fsta:close() battery = math.floor(cur * 100 / cap) if sta:match("Charging") then icon = "⚡" percent = "%" elseif sta:match("Unknown") then icon = "" percent = "%" elseif sta:match("Discharging") then icon = "" percent = "%" if tonumber(battery) < 15 then naughty.notify({ title = "Battery Warning" , text = "Battery low!".." "..battery..percent.." ".."left!" , timeout = 5 , position = "top_right" , fg = beautiful.fg_focus , bg = beautiful.bg_focus }) end end end return " "..icon..battery..percent.." " end rc.lua --- /etc/xdg/awesome/rc.lua 2014-04-11 18:36:26.000000000 +0900 +++ /home/itou-r/.config/awesome/rc.lua 2014-09-29 07:42:24.512655019 +0900 @@ -10,6 +10,8 @@ -- Notification library local naughty = require("naughty") local menubar = require("menubar") +-- Battery status widget +local battery = require("battery") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -111,6 +113,11 @@ -- {{{ Wibox -- Create a textclock widget mytextclock = awful.widget.textclock() +-- battery icon from http://findicons.com/search/battery +mybatteryicon = wibox.widget.imagebox() +mybatteryicon:set_image("/home/itou-r/.config/awesome/icons/battery_discharging_100-mod.png") +batterywidget = wibox.widget.textbox() +batterywidget:set_text(batteryInfo("BAT0")) -- Create a wibox for each screen and add it mywibox = {} @@ -190,6 +197,8 @@ -- Widgets that are aligned to the right local right_layout = wibox.layout.fixed.horizontal() + right_layout:add(mybatteryicon) + right_layout:add(batterywidget) if s == 1 then right_layout:add(wibox.widget.systray()) end right_layout:add(mytextclock) right_layout:add(mylayoutbox[s]) @@ -443,3 +452,10 @@ client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}} + + +batterywidget_timer = timer({timeout = 60}) +batterywidget_timer:connect_signal("timeout", function() + batterywidget:set_text(batteryInfo("BAT0")) +end) +batterywidget_timer:start()
vicious †Blingbling †フォント †Window のメニューフォントが大きすぎたので、変更した。いろいろ調べてみたが、lxappearance パッケージをインストールして調節するのが一番楽だった。 % sudo pacman -S lxappearance % lxappearance ThinkPad X61 では、デフォルトのフォントを "Cantarell 11" -> "Sans 9" にするとちょうどよい感じになった。lxappearance を実行すると、以下のファイルが生成されていた。 /.gtkrc-2.0 # DO NOT EDIT! This file will be overwritten by LXAppearance. # Any customization should be done in ~/.gtkrc-2.0.mine instead. gtk-theme-name="Adwaita" gtk-icon-theme-name="gnome" gtk-font-name="Sans 9" gtk-cursor-theme-size=0 gtk-toolbar-style=GTK_TOOLBAR_BOTH gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR gtk-button-images=1 gtk-menu-images=1 gtk-enable-event-sounds=1 gtk-enable-input-feedback-sounds=1 gtk-xft-antialias=1 gtk-xft-hinting=1 gtk-xft-hintstyle="hintfull" gtk-xft-rgba="rgb" include "/home/hogehoge/.gtkrc-2.0.mine"
Screenshot †スクリーンショットを撮るコマンドをインストールして、それを有効にすればよい。Scrotあたりが良さげな感じ。(ちなみに、Scrot の作者の Tom Gilbert 氏は以前よく使っていた camE の作者でもある。) ファイル名を指定しなければ %Y-%m-%d_%H%M%S_$wx$h_scrot.png という名前でカレントディレクトリに保存される。 カレントウィンドを撮る †$ scrot -u 遅延 †5秒後にスクリーンショットを撮る $ scrot -d 5 カウントダウンする †
情報 † |