awesomewm 音量配置为 pulse
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
local awful = require("awful");
|
local lain = require("lain")
|
||||||
|
local awful = require("awful")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local volume = lain.widget.pulse()
|
||||||
local altkey = "Mod1"
|
local altkey = "Mod1"
|
||||||
local modkey = "Mod4"
|
local modkey = "Mod4"
|
||||||
|
|
||||||
@@ -15,12 +17,12 @@ pravitekeys = awful.util.table.join(
|
|||||||
-- if app is running, raise it, otherwise launch it
|
-- if app is running, raise it, otherwise launch it
|
||||||
awful.key({ modkey }, "a",
|
awful.key({ modkey }, "a",
|
||||||
function ()
|
function ()
|
||||||
run_or_raise("android-studio", {class = "jetbrains-studio"})
|
run_or_raise("google-chrome-stable", {class = "Google-chrome"})
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.key({ modkey }, "q",
|
awful.key({ modkey }, "q",
|
||||||
function ()
|
function ()
|
||||||
run_or_raise("firefox", {class = "Firefox"})
|
run_or_raise("firefox", {class = "firefox"})
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.key({ modkey, "Shift" }, "v",
|
awful.key({ modkey, "Shift" }, "v",
|
||||||
@@ -50,37 +52,46 @@ pravitekeys = awful.util.table.join(
|
|||||||
run_or_raise("pcmanfm", {class = "Pcmanfm"})
|
run_or_raise("pcmanfm", {class = "Pcmanfm"})
|
||||||
end),
|
end),
|
||||||
|
|
||||||
-- ALSA volume control
|
awful.key({ modkey }, "p",
|
||||||
|
function ()
|
||||||
|
awful.spawn.with_shell("screenshot")
|
||||||
|
end),
|
||||||
|
|
||||||
|
-- PulseAudio volume control
|
||||||
awful.key({ }, "XF86AudioRaiseVolume",
|
awful.key({ }, "XF86AudioRaiseVolume",
|
||||||
function ()
|
function ()
|
||||||
os.execute(string.format("amixer set %s 1%%+", beautiful.volume.channel))
|
os.execute(string.format("pactl set-sink-volume %s +1%%", volume.device))
|
||||||
|
volume.update()
|
||||||
beautiful.volume.update()
|
beautiful.volume.update()
|
||||||
end),
|
end),
|
||||||
awful.key({ modkey }, "Up",
|
awful.key({ modkey }, "Up",
|
||||||
function ()
|
function ()
|
||||||
os.execute(string.format("amixer set %s 1%%+", beautiful.volume.channel))
|
os.execute(string.format("pactl set-sink-volume %s +1%%", volume.device))
|
||||||
|
volume.update()
|
||||||
beautiful.volume.update()
|
beautiful.volume.update()
|
||||||
end),
|
end),
|
||||||
awful.key({ }, "XF86AudioLowerVolume",
|
awful.key({ }, "XF86AudioLowerVolume",
|
||||||
function ()
|
function ()
|
||||||
os.execute(string.format("amixer set %s 1%%-", beautiful.volume.channel))
|
os.execute(string.format("pactl set-sink-volume %s -1%%", volume.device))
|
||||||
|
volume.update()
|
||||||
beautiful.volume.update()
|
beautiful.volume.update()
|
||||||
end),
|
end),
|
||||||
awful.key({ modkey }, "Down",
|
awful.key({ modkey }, "Down",
|
||||||
function ()
|
function ()
|
||||||
os.execute(string.format("amixer set %s 1%%-", beautiful.volume.channel))
|
os.execute(string.format("pactl set-sink-volume %s -1%%", volume.device))
|
||||||
|
volume.update()
|
||||||
beautiful.volume.update()
|
beautiful.volume.update()
|
||||||
end),
|
end),
|
||||||
awful.key({ }, "XF86AudioMute",
|
awful.key({ }, "XF86AudioMute",
|
||||||
function ()
|
function ()
|
||||||
os.execute(string.format("amixer set %s toggle", beautiful.volume.togglechannel
|
os.execute(string.format("pactl set-sink-mute %s toggle", volume.device))
|
||||||
or beautiful.volume.channel))
|
volume.update()
|
||||||
beautiful.volume.update()
|
beautiful.volume.update()
|
||||||
end),
|
end),
|
||||||
awful.key({ modkey, "Shift" }, "m",
|
awful.key({ modkey, "Shift" }, "m",
|
||||||
function ()
|
function ()
|
||||||
os.execute(string.format("amixer set %s toggle", beautiful.volume.togglechannel
|
os.execute(string.format("pactl set-sink-mute %s toggle", volume.device))
|
||||||
or beautiful.volume.channel))
|
volume.update()
|
||||||
beautiful.volume.update()
|
beautiful.volume.update()
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -756,7 +756,10 @@ awful.rules.rules = {
|
|||||||
properties = { titlebars_enabled = false } },
|
properties = { titlebars_enabled = false } },
|
||||||
|
|
||||||
-- Set Firefox to always map on the second tag on screen 1.
|
-- Set Firefox to always map on the second tag on screen 1.
|
||||||
{ rule = { class = "Firefox" },
|
{ rule = { class = "firefox" },
|
||||||
|
properties = { tag = mytags.specify.firefox }, maximized = true },
|
||||||
|
|
||||||
|
{ rule = { class = "Google-chrome" },
|
||||||
properties = { tag = mytags.specify.firefox }, maximized = true },
|
properties = { tag = mytags.specify.firefox }, maximized = true },
|
||||||
|
|
||||||
{ rule = { class = "mpv"},
|
{ rule = { class = "mpv"},
|
||||||
|
|||||||
7
script/screenshot
Normal file
7
script/screenshot
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
timestamp="$(date +%Y%m%d%H%M%S)"
|
||||||
|
targetbase="$HOME/screenshots"
|
||||||
|
mkdir -p $targetbase
|
||||||
|
[ -d $targetbase ] || exit 1
|
||||||
|
scrot -s $targetbase/$timestamp.png
|
||||||
Reference in New Issue
Block a user