You are not logged in.

#1 2017-11-13 12:33:47

MFserver
Member
From: Sweden
Registered: 2011-10-28
Posts: 46
Website

Issues with SDDM and pulseaudio

Hello everyone!

So I had a really weird issue after switching from starting my WM with xinit to using SDDM. I am using a theme with a video background, with sound, and it works as it should. When logged in, pulseaudio did not start when it was needed. However, if I start it manually, it works.

However, if I then kill my WM and drop back to SDDM, then log back in, it does not. I have found a really simple solution, running this in my startup script:

rm /tmp/.esd-1000/socket
rm -rf /tmp/pulse* ~/.pulse* ~/.config/pulse
pulseaudio -k
pulseaudio --start

It seems as if pulseaudio has problems with the already existing socket file when it is called again when I re-login. So far so good.

But, I did not have any kind of problem like this when using xinit, and I still don't on my laptop, which still uses xinit. They both run Arch linux, both run Xmonad with almost identical setups, they also have almost the same packages installed. I don't know if xinit autostarts pulseaudio on the laptop, but I haven't manually configured it to do so.

I feel like this is probably some kind of issue, and maybe I should report it somewhere so it can get fixed, or addressed in the wiki if it's supposed to be handled by the user. I don't know where though, if SDDM is supposed to clear the socket file on logout, if systemd is supposed to clear it, or if I'm supposed to do something with systemd when Xmonad is killed so it can handle logout-stuff before SDDM comes back.

Can anyone with a little more knowledge about systemd, xinit and/or SDDM point me in the right direction? smile

My ~/.xmonad/xmonad.hs:

-- Imports.
import XMonad
import Data.Monoid
import Data.List                   -- Required for class matching to work correctly
import System.IO
import System.Exit
import XMonad.Actions.CycleWS      -- Additional workspace cycling binds

import XMonad.Hooks.DynamicLog     -- statusbar
import XMonad.Hooks.EwmhDesktops   -- fullscreenEventHook fixes chrome fullscreen
import XMonad.Hooks.FadeInactive   -- Fade inactive windows
import XMonad.Hooks.ManageDocks    -- dock/tray mgmt
import XMonad.Hooks.ManageHelpers  -- To get fullscreen working
import XMonad.Hooks.UrgencyHook    -- window alert bells

import XMonad.Layout.Named         -- custom layout names
import XMonad.Layout.NoBorders     -- smart borders on solo clients
import XMonad.Layout.PerWorkspace  -- per-workspace settings

import XMonad.Util.EZConfig        -- append key/mouse bindings
import XMonad.Util.Run             -- spawnPipe and hPutStrLn

import XMonad.Util.Paste           -- Paste stuff, required for pasteSelection

import qualified XMonad.StackSet as W -- manageHook rules
import qualified Data.Map        as M

-- The main function.
main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig

-- Command to launch the bar.
myBar = "xmobar --alpha=180 -x 2 ~/.xmobarrc.hs"

-- Custom PP, configure it as you like. It determines what is being written to the bar.
myPP = xmobarPP { ppTitle = xmobarColor "#1793d1" "" . shorten 100
                , ppCurrent = xmobarColor "green" ""
                , ppUrgent = xmobarColor "red" ""
                , ppSep = " | " }

-- Key binding to toggle the gap for the bar.
toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)

-- Main configuration, override the defaults to your liking.
myConfig = defaultConfig { modMask            = mod1Mask                    -- mod1Mask=left alt, mod3Mask=right alt, mod4Mask=Win key
                         , terminal           = "xterm -fg white -bg black" -- default terminal emulator
                         , borderWidth        = 1                           -- width of the borders around windows
                         , normalBorderColor  = "#000000"                   -- default border color
                         , focusedBorderColor = "#000080"                   -- focused window border color
                         , focusFollowsMouse  = True
                         , workspaces         = ["Music","Web","Img","Remote","Term","IM","Dev","Files","Game","Misc","Work","Clear","Virt"]
                         , mouseBindings      = myMouseBindings
                         , layoutHook         = myLayoutHook
                         , manageHook         = myManageHook
                         , handleEventHook    = myEventHook
                         , startupHook        = myStartupHook
                         } `additionalKeys` myKeys
-- end

myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
    -- mod-button1, Set the window to floating mode and move by dragging
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))
    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
    -- you may also bind events to the mouse scroll wheel (button4 and button5)
    ]
-- end

myLayoutHook = avoidStruts $ smartBorders 
    $ onWorkspace "Web"    (Tall 1 (3/100) (35/52)) 
    $ onWorkspace "IM"  (Tall 1 (3/100) (3/4))
    $ onWorkspace "Dev"    (Tall 1 (3/100) (33/52))
    $ onWorkspace "Files"  (Tall 1 (3/100) (1/2))
    $ onWorkspace "School" (Tall 1 (3/100) (29/44))
    $ ( tiled ||| Mirror tiled )
    where tiled = Tall 1 (3 / 100) (5/9)
-- end

myManageHook :: ManageHook
myManageHook = composeAll . concat $
    [ [ resource  =? r --> doIgnore    | r <- ["desktop_window", "kdesktop"] ]
    , [ className =? c --> doFloat     | c <- ["Nitrogen", "Galculator", "Cowbell", "Pavucontrol", "KODI", "Opennx", "NXAgent"] ]
    , [ className =? c --> doFullFloat | c <- ["Gpicview"] ] -- needs fix, dialogs also displaying in fullscreen
    , [ fmap ("VLC" `isInfixOf`) title      --> doFloat ]
    , [ fmap ("Copying" `isInfixOf`) title  --> doFloat ]
    , [ fmap ("Moving" `isInfixOf`) title   --> doFloat ]
    , [ fmap ("Deleting" `isInfixOf`) title --> doFloat ]
    , [ className =? "Gimp"    --> doShift "Img" ] -- Shift GIMP to the Img desktop
    , [ fmap ("Digikam" `isInfixOf`) title --> doShift "Game" ] -- Shift Digikam to the Game desktop
    -- , [ fmap ("Steam" `isInfixOf`) title --> doShift "Game" ] -- Shift Steam to the Game desktop
    , [ fmap ("Lutris" `isInfixOf`) title --> doShift "Game" ] -- Shift Lutris to the Game desktop
    -- , [ fmap ("League of Legends" `isInfixOf`) title --> doShift "Game" ] -- Shift League of Legends to the Game desktop
    , [ fmap ("Age of Empires II:" `isInfixOf`) title --> doShift "Clear" ] -- Shift AoE2 to the clear desktop to get it to behave
    , [ fmap ("Discord" `isInfixOf`) title --> doShift "IM" ] -- Shift Discord to the IM desktop
    , [ (className =? "Chromium" <&&> fmap ("pop-up" `isSuffixOf`) role) --> doFloat ]
    , [ manageDocks ]
    , [ isFullscreen --> doFullFloat ] ]
    where role = stringProperty "WM_WINDOW_ROLE"
          icon = stringProperty "WM_ICON_NAME"
-- end

myKeys = [ ((mod1Mask, xK_Left)  , sendMessage Shrink)
         , ((mod1Mask, xK_Right) , sendMessage Expand)
         , ((mod1Mask, xK_Up)    , sendMessage (IncMasterN 1))
         , ((mod1Mask, xK_Down)  , sendMessage (IncMasterN (-1))) 
         -- Above: controlling tiling with the arrow keys
         -- Below: Quick access to applications
         , ((mod1Mask, xK_e)              , spawn "kate .xmonad/xmonad.hs .xmobarrc.hs .xmonad-start.sh .config/conky/conky.conf") 
         , ((mod1Mask .|. shiftMask, xK_f), spawn "dolphin") 
         , ((mod1Mask .|. shiftMask, xK_w), spawn "chromium")
         , ((mod1Mask, xK_k)              , spawn "setxkbmap -layout se && xmodmap .xmodmap")
         -- Volume controls and stuff
         , ((0, 0x1008ff12), spawn "pamixer -t") -- Mute button
         , ((0, 0x1008ff13), spawn "pamixer -i 5") -- Volume up
         , ((0, 0x1008ff11), spawn "pamixer -d 5") -- Volume down
         , ((0, 0x1008ffb2), spawn "pamixer -t --source 1") -- mute mic
         , ((0, 0x1008ff41), spawn "pavucontrol") -- open mixer
         -- Workspace-shifting: the name-list
         , ((mod4Mask, xK_q)              , toggleOrView "Music")
         , ((mod4Mask .|. shiftMask, xK_q), windows $ W.shift "Music")
         , ((mod4Mask, xK_w)              , toggleOrView "Web")
         , ((mod4Mask .|. shiftMask, xK_w), windows $ W.shift "Web")
         , ((mod4Mask, xK_e)              , toggleOrView "Img")
         , ((mod4Mask .|. shiftMask, xK_e), windows $ W.shift "Img")
         , ((mod4Mask, xK_r)              , toggleOrView "Remote")
         , ((mod4Mask .|. shiftMask, xK_r), windows $ W.shift "Remote")
         , ((mod4Mask, xK_t)              , toggleOrView "Term")
         , ((mod4Mask .|. shiftMask, xK_t), windows $ W.shift "Term")
         , ((mod4Mask, xK_s)              , toggleOrView "IM")
         , ((mod4Mask .|. shiftMask, xK_s), windows $ W.shift "IM")
         , ((mod4Mask, xK_d)              , toggleOrView "Dev")
         , ((mod4Mask .|. shiftMask, xK_d), windows $ W.shift "Dev")
         , ((mod4Mask, xK_f)              , toggleOrView "Files")
         , ((mod4Mask .|. shiftMask, xK_f), windows $ W.shift "Files")
         , ((mod4Mask, xK_g)              , toggleOrView "Game")
         , ((mod4Mask .|. shiftMask, xK_g), windows $ W.shift "Game")
         , ((mod4Mask, xK_z)              , toggleOrView "Misc")
         , ((mod4Mask .|. shiftMask, xK_z), windows $ W.shift "Misc")
         , ((mod4Mask, xK_x)              , toggleOrView "Work")
         , ((mod4Mask .|. shiftMask, xK_x), windows $ W.shift "Work")
         , ((mod4Mask, xK_c)              , toggleOrView "Clear")
         , ((mod4Mask .|. shiftMask, xK_c), windows $ W.shift "Clear")
         , ((mod4Mask, xK_v)              , toggleOrView "Virt")
         , ((mod4Mask .|. shiftMask, xK_v), windows $ W.shift "Virt")
         -- Other workspace-shifting: moving around without knowing where you're going
         , ((mod4Mask, xK_Left),                prevWS)
         , ((mod4Mask, xK_Right),               nextWS)
         , ((mod4Mask .|. shiftMask, xK_Left),  shiftToPrev)
         , ((mod4Mask .|. shiftMask, xK_Right), shiftToNext)
         , ((mod4Mask, xK_space)              , moveTo Next EmptyWS)
         , ((mod4Mask .|. shiftMask, xK_space), moveTo Next NonEmptyWS)
         -- X-selection-paste buffer, paste selection buffer when Insert is pressed
         , ((0, xK_Insert), pasteSelection)
         -- Screenshot. Pretty important. 
         , ((0, xK_Print)              , spawn "cd ~/ramdisk; scrot")
         , ((mod1Mask, xK_Print), spawn "cd ~/ramdisk; scrot -s -b")]

myEventHook = mempty
-- myStartupHook = mempty
myStartupHook = do
    spawn "./.xmonad-start.sh"

~/.xmonad-start.sh

#!/bin/bash

export GTK2_RC_FILES="$HOME/.gtkrc-2.0"

# To make libreOffice behave
export SAL_USE_VCLPLUGIN=gtk3 lowriter

# xmodmap
/usr/bin/xmodmap $HOME/.xmodmap

# To make HP screen less blue
# xcalib -s 1 /usr/share/color/icc/LVDS.icc
rm /tmp/.esd-1000/socket
rm -rf /tmp/pulse* ~/.pulse* ~/.config/pulse
pulseaudio -k
pulseaudio --start

# Start my private DE's programs
killall conky
killall stalonetray
killall dropbox
stalonetray --kludges force_icons_size &
conky .config/conky/conky.conf &
nitrogen --restore &
dropbox &
sudo mount $HOME/.cache &
sudo mount $HOME/ramdisk &

Sometimes, when I'm trying to get any audio software or hardware working with my system, I wonder why I ditched Windows. But every time I work at a windows computer, I remember it again.

Offline

Board footer

Powered by FluxBB