{"id":1158,"date":"2018-07-14T22:25:46","date_gmt":"2018-07-14T21:25:46","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=1158"},"modified":"2018-07-16T23:16:02","modified_gmt":"2018-07-16T22:16:02","slug":"linux-sound-volume-commands","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/linux-sound-volume-commands\/","title":{"rendered":"Linux sound\/volume commands"},"content":{"rendered":"<p>Source:\u00a0https:\/\/unix.stackexchange.com\/questions\/342554\/how-to-enable-my-keyboards-volume-keys-in-xfce\/342555<\/p>\n<p>For binding to keyboard shortcuts:<\/p>\n<pre class=\"lang:sh decode:true\">#(Volume Up)\r\namixer set Master 5%+ \r\n#(Volume Down)\r\namixer set Master 5%-\r\n# (Mute\/Unmute)\r\namixer set Master toggle<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh decode:true\"># get volume: Right\r\namixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }'\r\n85%\r\n# get volume: Left\r\namixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }'\r\n85%<\/pre>\n<pre class=\"lang:sh decode:true \" title=\"volume.sh\">#!\/bin\/bash\r\n\r\nmute=audio-volume-muted\r\nhigh=audio-volume-high\r\nlow=audio-volume-low\r\nicon=$low\r\n\r\nnotify() {\r\n    volume=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }')\r\n    notify-send \"Volume\" \"$volume\" -u normal -t 400 -i $icon\r\n}\r\n\r\nnotify_mute() {\r\n    state=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $4 }')\r\n    if [ \"$state\" = \"on\" ]; then\r\n        icon=$high\r\n        message=\"Unmute\"\r\n    fi    \r\n\r\n    if [ \"$state\" = \"off\" ]; then\r\n        icon=$mute\r\n        message=\"Mute\"\r\n    fi    \r\n    notify-send \"Volume\" \"$message\" -u normal -t 1000 -i $icon\r\n}\r\n\r\nup() {\r\n    icon=$high\r\n    amixer set Master 5%+ \r\n    notify\r\n}\r\n\r\ndown() {\r\n    icon=$low\r\n    amixer set Master 5%- \r\n    notify\r\n}\r\n\r\ntoggle() {\r\n    amixer set Master toggle\r\n    notify_mute\r\n}\r\n\r\nif [ \"$1\" = \"up\" ]; then\r\n    up\r\nfi\r\n\r\nif [ \"$1\" = \"down\" ]; then\r\n    down\r\nfi\r\n\r\nif [ \"$1\" = \"toggle\" ]; then\r\n    toggle\r\nfi<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source:\u00a0https:\/\/unix.stackexchange.com\/questions\/342554\/how-to-enable-my-keyboards-volume-keys-in-xfce\/342555 For binding to keyboard shortcuts: #(Volume Up) amixer set Master 5%+ #(Volume Down) amixer set Master 5%- # (Mute\/Unmute) amixer set Master toggle &nbsp; # get volume: Right amixer sget Master | grep &#8216;Right:&#8217; | awk -F'[][]&#8217; &#8216;{ print $2 }&#8217; 85% # get volume: Left amixer sget Master | grep &#8216;Left:&#8217; | awk [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1158","post","type-post","status-publish","format-standard","hentry","category-other-scripts"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=1158"}],"version-history":[{"count":5,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1158\/revisions"}],"predecessor-version":[{"id":1174,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1158\/revisions\/1174"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}