kbd notif in awesome

This commit is contained in:
Simonas Narbutas
2018-07-30 14:57:54 +02:00
parent 2e41d7601d
commit fd56f2ca1c
4 changed files with 46 additions and 10 deletions

10
.bin/kbdswitch Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
LANG1="us"
LANG2="lt"
CURRENT_LANG=$(setxkbmap -query | grep layout |awk -F" " '{print $2}')
if [ "$CURRENT_LANG" = $LANG1 ]; then
setxkbmap $LANG2 && echo $LANG2
else
setxkbmap $LANG1 && echo $LANG1
fi
xmodmap ~/.Xmodmap

View File

@@ -1,12 +1,15 @@
#!/bin/sh #!/bin/sh
DISPLAY_COUNT=$(xrandr -d :0 -q | grep ' connected' | wc -l) DISPLAY_COUNT=$(xrandr -d :0 -q | grep ' connected' | wc -l)
if [ "$DISPLAY_COUNT" == 2 ] if [ "$DISPLAY_COUNT" == 3 ]
then then
xrandr --output HDMI2 --set "Broadcast RGB" "Full" --off --output HDMI1 --mode 2560x1440 --pos 1920x0 --rotate normal --output DP1 --set "Broadcast RGB" "Full" --off --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal --output VIRTUAL1 --off xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal
xrandr --output DP1-2 --mode 2560x1440 --pos 4480x0 --rotate normal
xrandr --output DP1-1 --mode 2560x1440 --pos 1920x0 --rotate normal
elif [ "$DISPLAY_COUNT" == 1 ] elif [ "$DISPLAY_COUNT" == 1 ]
then then
xrandr --output HDMI2 --off --output HDMI1 --off --output DP1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
elif [ "$DISPLAY_COUNT" == 3 ] elif [ "$DISPLAY_COUNT" == 2 ]
then then
xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output DP1-2 --mode 2560x1440 --pos 4480x0 --rotate normal --output DP1-1 --mode 2560x1440 --pos 1920x0 --rotate normal xrandr --output HDMI1 --mode 2560x1440 --pos 1920x0 --rotate normal
xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal
fi fi

View File

@@ -14,7 +14,10 @@ setw -g pane-base-index 1
#set-window-option -g window-status-current-bg yellow #set-window-option -g window-status-current-bg yellow
#set -ga terminal-overrides ",xterm-termite:Tc" #set -ga terminal-overrides ",xterm-termite:Tc"
set -g default-terminal "screen-256color" set -g default-terminal "screen-256color"
#set -g mouse on set -g mouse on
set -g history-limit 30000
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
set -g status-position bottom set -g status-position bottom
set -g status-bg black set -g status-bg black

View File

@@ -120,6 +120,8 @@ mykeyboardlayout = awful.widget.keyboardlayout()
-- Create a textclock widget -- Create a textclock widget
mytextclock = wibox.widget.textclock() mytextclock = wibox.widget.textclock()
local cal_notification local cal_notification
-- {{{ Calendar
mytextclock:connect_signal("button::release", mytextclock:connect_signal("button::release",
function() function()
if cal_notification == nil then if cal_notification == nil then
@@ -127,9 +129,6 @@ mytextclock:connect_signal("button::release",
function(stdout, stderr, reason, exit_code) function(stdout, stderr, reason, exit_code)
cal_notification = naughty.notify{ cal_notification = naughty.notify{
text = stdout, text = stdout,
-- text = string.gsub(string.gsub(stdout,
-- "+", "<span foreground='red'><b>"),
-- "-", "</b></span>"),
font = "Source Code Pro", font = "Source Code Pro",
timeout = 0, timeout = 0,
width = auto, width = auto,
@@ -141,7 +140,24 @@ mytextclock:connect_signal("button::release",
naughty.destroy(cal_notification) naughty.destroy(cal_notification)
end end
end) end)
-- }}}
-- {{{ change keyboard layout
mykeyboardlayout:connect_signal("button::release",
function()
if kbd_notification == nil then
awful.spawn.easy_async([[sh -c "~/.bin/kbdswitch"]], function(stdout, stderr, reason, exit_code)
kbd_notification = naughty.notify{
title = "Keyboard",
text = stdout,
timeout = 0.5,
destroy = function() kbd_notification = nil end}
end)
else
naughty.destroy(kbd_notification)
end
end)
-- }}}
-- Create a wibox for each screen and add it -- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join( local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end), awful.button({ }, 1, function(t) t:view_only() end),
@@ -382,6 +398,10 @@ globalkeys = gears.table.join(
function () function ()
awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next", naughty.notify {title = "Next", timeout = 0.5, bg = "#ad11c7"}) awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next", naughty.notify {title = "Next", timeout = 0.5, bg = "#ad11c7"})
end), end),
awful.key({ "Control", "Mod4" }, "s",
function ()
awful.util.spawn_with_shell("sleep .1 && scrot -s '%d-%m-%y_%H:%M:%s_scrot.png' -e 'mv $f ~/Pictures/scrots/'", naughty.notify {text = "scrot complete", timeout = 0.5, bg = "#ad11c7"})
end),
awful.key({ modkey, "Control" }, "n", awful.key({ modkey, "Control" }, "n",
function () function ()